public final class LittleEndianDatatypeCoder extends DefaultDatatypeCoder
For wire protocol use DefaultDatatypeCoder
.
DatatypeCoder.RawDateTimeStruct
FRACTIONS_PER_HOUR, FRACTIONS_PER_MILLISECOND, FRACTIONS_PER_MINUTE, FRACTIONS_PER_SECOND, NANOSECONDS_PER_FRACTION
Constructor and Description |
---|
LittleEndianDatatypeCoder(IEncodingFactory encodingFactory)
Creates a little-endian datatype coder for native access on little-endian platforms.
|
Modifier and Type | Method and Description |
---|---|
Decimal128 |
decodeDecimal128(byte[] data)
Decodes a decimal128 from byte array.
|
Decimal64 |
decodeDecimal64(byte[] data)
Decodes a decimal64 from byte array.
|
int |
decodeInt(byte[] byte_int)
Decode a
byte array into an int value. |
int |
decodeInt(byte[] bytes,
int fromIndex)
Decode a
byte array to an int value. |
java.math.BigInteger |
decodeInt128(byte[] data)
Decodes a BigInteger from byte array.
|
long |
decodeLong(byte[] byte_int)
Decode a
byte array into a long value. |
short |
decodeShort(byte[] byte_int)
Decode a
byte array into a short value. |
short |
decodeShort(byte[] bytes,
int fromIndex)
Decode from a
byte array to a short value. |
byte[] |
encodeDecimal128(Decimal128 decimal128)
Encodes a decimal128 to a byte array.
|
byte[] |
encodeDecimal64(Decimal64 decimal64)
Encodes a decimal64 to a byte array.
|
byte[] |
encodeInt(int value)
Encode an
int value as a byte array. |
void |
encodeInt(int value,
byte[] target,
int fromIndex)
Encode an
int value into the target byte array starting at index fromIndex . |
byte[] |
encodeInt128(java.math.BigInteger bigInteger)
Encodes a BigInteger to a 16-byte byte array.
|
byte[] |
encodeLong(long value)
Encode a
long value as a byte array. |
void |
encodeShort(int value,
byte[] target,
int fromIndex)
Encode a
short value into the target byte array starting at index fromIndex . |
byte[] |
encodeShort(short value)
Encode a
short value as a byte array. |
static LittleEndianDatatypeCoder |
forEncodingFactory(IEncodingFactory encodingFactory)
Returns an instance of
LittleEndianDatatypeCoder for an encoding factory. |
int |
sizeOfShort()
The size of an encoded short in this data type coder.
|
createReader, createWriter, decodeBoolean, decodeDate, decodeDateCalendar, decodeDateRaw, decodeDouble, decodeFloat, decodeLocalDate, decodeLocalDateTime, decodeLocalTime, decodeString, decodeTime, decodeTimeCalendar, decodeTimeRaw, decodeTimestamp, decodeTimestampCalendar, decodeTimestampRaw, encodeBoolean, encodeDate, encodeDateCalendar, encodeDateRaw, encodeDouble, encodeFloat, encodeLocalDate, encodeLocalDateTime, encodeLocalTime, encodeShort, encodeString, encodeTime, encodeTimeCalendar, encodeTimeRaw, encodeTimestamp, encodeTimestampCalendar, encodeTimestampRaw, equals, forEncodingDefinition, getEncoding, getEncodingDefinition, getEncodingFactory, hashCode, intToBytes, unwrap
public LittleEndianDatatypeCoder(IEncodingFactory encodingFactory)
In almost all cases, it is better to use forEncodingFactory(IEncodingFactory)
.
encodingFactory
- Encoding factorypublic static LittleEndianDatatypeCoder forEncodingFactory(IEncodingFactory encodingFactory)
LittleEndianDatatypeCoder
for an encoding factory.encodingFactory
- Encoding factorypublic int sizeOfShort()
DatatypeCoder
sizeOfShort
in interface DatatypeCoder
sizeOfShort
in class DefaultDatatypeCoder
2
or 4
bytes)public byte[] encodeShort(short value)
DatatypeCoder
short
value as a byte
array.encodeShort
in interface DatatypeCoder
encodeShort
in class DefaultDatatypeCoder
value
- The value to be encodedvalue
encoded as a byte
arrayDatatypeCoder.encodeShort(int)
public void encodeShort(int value, byte[] target, int fromIndex)
DatatypeCoder
short
value into the target
byte array starting at index fromIndex
.encodeShort
in interface DatatypeCoder
encodeShort
in class DefaultDatatypeCoder
value
- The value to be encodedtarget
- Target byte array of sufficient size (warning: this may be datatype coder specific)fromIndex
- Index to start writingpublic short decodeShort(byte[] byte_int)
DatatypeCoder
byte
array into a short
value.decodeShort
in interface DatatypeCoder
decodeShort
in class DefaultDatatypeCoder
byte_int
- The byte
array to be decodedshort
value of the decoded byte
arraypublic short decodeShort(byte[] bytes, int fromIndex)
DatatypeCoder
byte
array to a short
value.decodeShort
in interface DatatypeCoder
decodeShort
in class DefaultDatatypeCoder
bytes
- The byte
array to be decodedfromIndex
- The index to start readingshort
value of the decoded byte
arraypublic byte[] encodeInt(int value)
DatatypeCoder
int
value as a byte
array.encodeInt
in interface DatatypeCoder
encodeInt
in class DefaultDatatypeCoder
value
- The value to be encodedvalue
encoded as a byte
arraypublic void encodeInt(int value, byte[] target, int fromIndex)
DatatypeCoder
int
value into the target
byte array starting at index fromIndex
.encodeInt
in interface DatatypeCoder
encodeInt
in class DefaultDatatypeCoder
value
- The value to be encodedtarget
- Target byte array of sufficient sizefromIndex
- Index to start writingpublic int decodeInt(byte[] byte_int)
DatatypeCoder
byte
array into an int
value.decodeInt
in interface DatatypeCoder
decodeInt
in class DefaultDatatypeCoder
byte_int
- The byte
array to be decodedint
value of the decoded byte
arraypublic int decodeInt(byte[] bytes, int fromIndex)
DatatypeCoder
byte
array to an int
value.decodeInt
in interface DatatypeCoder
decodeInt
in class DefaultDatatypeCoder
bytes
- The byte
array to be decodedfromIndex
- The index to start readingint
value of the decoded byte
arraypublic byte[] encodeLong(long value)
DatatypeCoder
long
value as a byte
array.encodeLong
in interface DatatypeCoder
encodeLong
in class DefaultDatatypeCoder
value
- The value to be encodedvalue
encoded as a byte
arraypublic long decodeLong(byte[] byte_int)
DatatypeCoder
byte
array into a long
value.decodeLong
in interface DatatypeCoder
decodeLong
in class DefaultDatatypeCoder
byte_int
- The byte
array to be decodedlong
value of the decoded byte
arraypublic Decimal64 decodeDecimal64(byte[] data)
DatatypeCoder
decodeDecimal64
in interface DatatypeCoder
decodeDecimal64
in class DefaultDatatypeCoder
data
- Data to decode (expected 8 bytes)public byte[] encodeDecimal64(Decimal64 decimal64)
DatatypeCoder
encodeDecimal64
in interface DatatypeCoder
encodeDecimal64
in class DefaultDatatypeCoder
decimal64
- The decimal64 value to be encodedpublic Decimal128 decodeDecimal128(byte[] data)
DatatypeCoder
decodeDecimal128
in interface DatatypeCoder
decodeDecimal128
in class DefaultDatatypeCoder
data
- Data to decode (expected 16 bytes)public byte[] encodeDecimal128(Decimal128 decimal128)
DatatypeCoder
encodeDecimal128
in interface DatatypeCoder
encodeDecimal128
in class DefaultDatatypeCoder
decimal128
- The decimal128 value to be encodedpublic java.math.BigInteger decodeInt128(byte[] data)
DatatypeCoder
decodeInt128
in interface DatatypeCoder
decodeInt128
in class DefaultDatatypeCoder
data
- Data to decode (expected 16 bytes)public byte[] encodeInt128(java.math.BigInteger bigInteger)
DatatypeCoder
The implementation expects to be passed a value that fits in 16 bytes. If a larger value is passed, and
IllegalArgumentException
is thrown.
encodeInt128
in interface DatatypeCoder
encodeInt128
in class DefaultDatatypeCoder
bigInteger
- The BigInteger value to be encodedCopyright © 2001-2024 Jaybird (Firebird JDBC) team. All rights reserved.