Class ByteArrayBinaryDtoFieldCodec
java.lang.Object
io.datarouter.bytes.binarydto.fieldcodec.BinaryDtoBaseFieldCodec<byte[]>
io.datarouter.bytes.binarydto.fieldcodec.array.ByteArrayBinaryDtoFieldCodec
public class ByteArrayBinaryDtoFieldCodec extends BinaryDtoBaseFieldCodec<byte[]>
Bytes are stored without transformation.
When comparing:
- shortest arrays are first due to the length prefix
- positive values are before negative values due to unsigned comparison
-
Constructor Summary
Constructors Constructor Description ByteArrayBinaryDtoFieldCodec() -
Method Summary
Modifier and Type Method Description intcompareAsIfEncoded(byte[] left, byte[] right)Override this with optimized implementations that avoid encoding.byte[]decode(byte[] bytes, int offset, int length)byte[]encode(byte[] value)booleansupportsComparableCodec()Override with true if the codec is suitable for comparable encoding.Methods inherited from class io.datarouter.bytes.binarydto.fieldcodec.BinaryDtoBaseFieldCodec
decode, fixedLength, isFixedLength, isVariableLength
-
Constructor Details
-
ByteArrayBinaryDtoFieldCodec
public ByteArrayBinaryDtoFieldCodec()
-
-
Method Details
-
supportsComparableCodec
public boolean supportsComparableCodec()Description copied from class:BinaryDtoBaseFieldCodecOverride with true if the codec is suitable for comparable encoding.- Specified by:
supportsComparableCodecin classBinaryDtoBaseFieldCodec<byte[]>
-
encode
public byte[] encode(byte[] value)- Specified by:
encodein classBinaryDtoBaseFieldCodec<byte[]>
-
decode
public byte[] decode(byte[] bytes, int offset, int length)- Specified by:
decodein classBinaryDtoBaseFieldCodec<byte[]>
-
compareAsIfEncoded
public int compareAsIfEncoded(byte[] left, byte[] right)Description copied from class:BinaryDtoBaseFieldCodecOverride this with optimized implementations that avoid encoding.- Overrides:
compareAsIfEncodedin classBinaryDtoBaseFieldCodec<byte[]>
-