Skip to content

Commit

Permalink
Fix capitalized method name ToByteArray in RediSearchUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 committed Sep 19, 2023
1 parent cae3ce7 commit 0c78fdb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/main/java/redis/clients/jedis/search/RediSearchUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,20 @@ public static Map<String, String> toStringMap(Map<String, Object> input) {
* @param input float array
* @return byte array
*/
public static byte[] ToByteArray(float[] input) {
public static byte[] toByteArray(float[] input) {
byte[] bytes = new byte[Float.BYTES * input.length];
ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).asFloatBuffer().put(input);
return bytes;
}

/**
* @deprecated Use {@link RediSearchUtil#toByteArray(float[])}.
*/
@Deprecated
public static byte[] ToByteArray(float[] input) {
return toByteArray(input);
}

private RediSearchUtil() {
throw new InstantiationError("Must not instantiate this class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class UtilTest {
@Test
public void floatArrayToByteArray() {
float[] floats = new float[]{0.2f};
byte[] bytes = RediSearchUtil.ToByteArray(floats);
byte[] bytes = RediSearchUtil.toByteArray(floats);
byte[] expected = new byte[]{-51, -52, 76, 62};
Assert.assertArrayEquals(expected, bytes);
}
Expand Down

0 comments on commit 0c78fdb

Please sign in to comment.