Class PayloadHelper
java.lang.Object
org.apache.lucene.analysis.payloads.PayloadHelper
Utility methods for encoding payloads.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic float
decodeFloat
(byte[] bytes) static final float
decodeFloat
(byte[] bytes, int offset) Decode the payload that was encoded usingencodeFloat(float)
.static final int
decodeInt
(byte[] bytes, int offset) static byte[]
encodeFloat
(float payload) static byte[]
encodeFloat
(float payload, byte[] data, int offset) static byte[]
encodeInt
(int payload) static byte[]
encodeInt
(int payload, byte[] data, int offset)
-
Constructor Details
-
PayloadHelper
public PayloadHelper()
-
-
Method Details
-
encodeFloat
public static byte[] encodeFloat(float payload) -
encodeFloat
public static byte[] encodeFloat(float payload, byte[] data, int offset) -
encodeInt
public static byte[] encodeInt(int payload) -
encodeInt
public static byte[] encodeInt(int payload, byte[] data, int offset) -
decodeFloat
public static float decodeFloat(byte[] bytes) - Returns:
- the decoded float
- See Also:
-
decodeFloat
public static final float decodeFloat(byte[] bytes, int offset) Decode the payload that was encoded usingencodeFloat(float)
. NOTE: the length of the array must be at least offset + 4 long.- Parameters:
bytes
- The bytes to decodeoffset
- The offset into the array.- Returns:
- The float that was encoded
- See Also:
-
decodeInt
public static final int decodeInt(byte[] bytes, int offset)
-