Package org.firebirdsql.gds.ng
Class DefaultDatatypeCoder
- java.lang.Object
- 
- org.firebirdsql.gds.ng.DefaultDatatypeCoder
 
- 
- All Implemented Interfaces:
- DatatypeCoder
 - Direct Known Subclasses:
- BigEndianDatatypeCoder,- LittleEndianDatatypeCoder
 
 public class DefaultDatatypeCoder extends java.lang.Object implements DatatypeCoder The default datatype coder.Implements the encoding and decoding for the wire protocol. As a lot of the implementation also applies to the big endian and little endian decoders for the JNA implementation, this class is not placed in package org.firebirdsql.gds.ng.wire- Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.firebirdsql.gds.ng.DatatypeCoderDatatypeCoder.RawDateTimeStruct
 
- 
 - 
Field Summary- 
Fields inherited from interface org.firebirdsql.gds.ng.DatatypeCoderFRACTIONS_PER_HOUR, FRACTIONS_PER_MILLISECOND, FRACTIONS_PER_MINUTE, FRACTIONS_PER_SECOND, NANOSECONDS_PER_FRACTION
 
- 
 - 
Constructor SummaryConstructors Constructor Description DefaultDatatypeCoder(IEncodingFactory encodingFactory)Creates a default datatype coder for the wire protocol.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.ReadercreateReader(java.io.InputStream inputStream)Creates a reader wrapping an input stream.java.io.WritercreateWriter(java.io.OutputStream outputStream)Creates a writer wrapping an input stream.booleandecodeBoolean(byte[] data)Decode boolean from supplied data.java.sql.DatedecodeDate(byte[] byte_int)Decode abytearray into aDatevalue.java.sql.DatedecodeDate(java.sql.Date d, java.util.Calendar cal)Decode aDatevalue using a givenCalendar.java.sql.DatedecodeDateCalendar(byte[] byte_int, java.util.Calendar c)DatatypeCoder.RawDateTimeStructdecodeDateRaw(byte[] byte_int)Decode abytearray into a raw date time struct.Decimal128decodeDecimal128(byte[] data)Decodes a decimal128 from byte array.Decimal64decodeDecimal64(byte[] data)Decodes a decimal64 from byte array.doubledecodeDouble(byte[] byte_int)Decode abytearray into adoublevalue.floatdecodeFloat(byte[] byte_int)Decode abytearray into afloatvalue.intdecodeInt(byte[] byte_int)Decode abytearray into anintvalue.intdecodeInt(byte[] bytes, int fromIndex)Decode abytearray to anintvalue.java.math.BigIntegerdecodeInt128(byte[] data)Decodes a BigInteger from byte array.longdecodeLong(byte[] byte_int)Decode abytearray into alongvalue.shortdecodeShort(byte[] byte_int)Decode abytearray into ashortvalue.shortdecodeShort(byte[] bytes, int fromIndex)Decode from abytearray to ashortvalue.java.lang.StringdecodeString(byte[] value)Decode an encodedbytearray into aStringusing the encoding of this datatype coder.java.sql.TimedecodeTime(byte[] int_byte)Decode abytearray into aTimevalue.java.sql.TimedecodeTime(java.sql.Time d, java.util.Calendar cal, boolean invertTimeZone)Decode aTimevalue using a givenCalendar.java.sql.TimedecodeTimeCalendar(byte[] int_byte, java.util.Calendar c)DatatypeCoder.RawDateTimeStructdecodeTimeRaw(byte[] int_byte)Decode abytearray into a raw date time struct.java.sql.TimestampdecodeTimestamp(byte[] byte_long)Decode a 8-bytebytearray into aTimestamp.java.sql.TimestampdecodeTimestamp(java.sql.Timestamp value, java.util.Calendar cal)Decode aTimestampvalue using a givenCalendar.java.sql.TimestampdecodeTimestamp(java.sql.Timestamp value, java.util.Calendar cal, boolean invertTimeZone)Decode aTimestampvalue using a givenCalendar.java.sql.TimestampdecodeTimestampCalendar(byte[] byte_long, java.util.Calendar c)DatatypeCoder.RawDateTimeStructdecodeTimestampRaw(byte[] byte_long)Decode a 8-bytebytearray into a raw date time struct.byte[]encodeBoolean(boolean value)Encodes boolean to 1 byte data.byte[]encodeDate(java.sql.Date d)Encode aDatevalue into abytearray.java.sql.DateencodeDate(java.sql.Date d, java.util.Calendar cal)Encode a givenDatevalue using a givenCalendar.byte[]encodeDateCalendar(java.sql.Date d, java.util.Calendar c)byte[]encodeDateRaw(DatatypeCoder.RawDateTimeStruct raw)Encode the date portion of a raw date time struct into abytearray.byte[]encodeDecimal128(Decimal128 decimal128)Encodes a decimal128 to a byte array.byte[]encodeDecimal64(Decimal64 decimal64)Encodes a decimal64 to a byte array.byte[]encodeDouble(double value)Encode adoublevalue as abytearray.byte[]encodeFloat(float value)Encode afloatvalue as abytearray.byte[]encodeInt(int value)Encode anintvalue as abytearray.voidencodeInt(int value, byte[] target, int fromIndex)Encode anintvalue into thetargetbyte array starting at indexfromIndex.byte[]encodeInt128(java.math.BigInteger bigInteger)Encodes a BigInteger to a 16-byte byte array.byte[]encodeLocalDate(int year, int month, int day)Encodes a java.time.LocalDate equivalent to date bytes.byte[]encodeLocalDateTime(int year, int month, int day, int hour, int minute, int second, int nanos)Encodes a java.time.LocalDateTime equivalent to timestamp bytes.byte[]encodeLocalTime(int hour, int minute, int second, int nanos)Encodes a java.time.LocalTime equivalent to time bytes.byte[]encodeLong(long value)Encode alongvalue as abytearray.byte[]encodeShort(int value)Encode ashortvalue as abytearray.voidencodeShort(int value, byte[] target, int fromIndex)Encode ashortvalue into thetargetbyte array starting at indexfromIndex.byte[]encodeShort(short value)Encode ashortvalue as abytearray.byte[]encodeString(java.lang.String value)Encode aStringvalue into abytearray using the encoding of this datatype coder.byte[]encodeTime(java.sql.Time d)Encode aTimevalue into abytearray.java.sql.TimeencodeTime(java.sql.Time d, java.util.Calendar cal, boolean invertTimeZone)Encode a givenTimevalue using a givenCalendar.byte[]encodeTimeCalendar(java.sql.Time d, java.util.Calendar c)byte[]encodeTimeRaw(DatatypeCoder.RawDateTimeStruct raw)Encode the time portion of a raw date time struct into abytearray.byte[]encodeTimestamp(java.sql.Timestamp value)Encode aTimestampas abytearray.java.sql.TimestampencodeTimestamp(java.sql.Timestamp value, java.util.Calendar cal)Encode aTimestampusing a givenCalendar.java.sql.TimestampencodeTimestamp(java.sql.Timestamp value, java.util.Calendar cal, boolean invertTimeZone)Encode aTimestampusing a givenCalendar.byte[]encodeTimestampCalendar(java.sql.Timestamp value, java.util.Calendar c)byte[]encodeTimestampRaw(DatatypeCoder.RawDateTimeStruct raw)Encode the date and time portions of a raw date time struct into abytearray.booleanequals(java.lang.Object o)DatatypeCoderforEncodingDefinition(EncodingDefinition encodingDefinition)Return a derived datatype coder that applies the supplied encoding definition for string conversions.static DefaultDatatypeCoderforEncodingFactory(IEncodingFactory encodingFactory)Returns an instance ofDefaultDatatypeCoderfor an encoding factory.EncodinggetEncoding()EncodingDefinitiongetEncodingDefinition()IEncodingFactorygetEncodingFactory()inthashCode()protected byte[]intToBytes(int value)Encode anintvalue as abytearray in network-order(big-endian) representation.intsizeOfShort()The size of an encoded short in this data type coder.DatatypeCoderunwrap()Unwrap this datatype coder to its parent (or itself).
 
- 
- 
- 
Constructor Detail- 
DefaultDatatypeCoderpublic DefaultDatatypeCoder(IEncodingFactory encodingFactory) Creates a default datatype coder for the wire protocol.In almost all cases, it is better to use forEncodingFactory(IEncodingFactory).- Parameters:
- encodingFactory- Encoding factory
 
 
- 
 - 
Method Detail- 
forEncodingFactorypublic static DefaultDatatypeCoder forEncodingFactory(IEncodingFactory encodingFactory) Returns an instance ofDefaultDatatypeCoderfor an encoding factory.- Parameters:
- encodingFactory- Encoding factory
- Returns:
- Datatype coder, this might be a cached instance
 
 - 
sizeOfShortpublic int sizeOfShort() Description copied from interface:DatatypeCoderThe size of an encoded short in this data type coder.- Specified by:
- sizeOfShortin interface- DatatypeCoder
- Returns:
- The size of an encoded short (either 2or4bytes)
 
 - 
encodeShortpublic byte[] encodeShort(short value) Description copied from interface:DatatypeCoderEncode ashortvalue as abytearray.- Specified by:
- encodeShortin interface- DatatypeCoder
- Parameters:
- value- The value to be encoded
- Returns:
- The value of valueencoded as abytearray
- See Also:
- DatatypeCoder.encodeShort(int)
 
 - 
encodeShortpublic byte[] encodeShort(int value) Description copied from interface:DatatypeCoderEncode ashortvalue as abytearray.- Specified by:
- encodeShortin interface- DatatypeCoder
- Parameters:
- value- The value to be encoded
- Returns:
- The value of valueencoded as abytearray
 
 - 
encodeShortpublic void encodeShort(int value, byte[] target, int fromIndex)Description copied from interface:DatatypeCoderEncode ashortvalue into thetargetbyte array starting at indexfromIndex.- Specified by:
- encodeShortin interface- DatatypeCoder
- Parameters:
- value- The value to be encoded
- target- Target byte array of sufficient size (warning: this may be datatype coder specific)
- fromIndex- Index to start writing
 
 - 
decodeShortpublic short decodeShort(byte[] byte_int) Description copied from interface:DatatypeCoderDecode abytearray into ashortvalue.- Specified by:
- decodeShortin interface- DatatypeCoder
- Parameters:
- byte_int- The- bytearray to be decoded
- Returns:
- The shortvalue of the decodedbytearray
 
 - 
decodeShortpublic short decodeShort(byte[] bytes, int fromIndex)Description copied from interface:DatatypeCoderDecode from abytearray to ashortvalue.- Specified by:
- decodeShortin interface- DatatypeCoder
- Parameters:
- bytes- The- bytearray to be decoded
- fromIndex- The index to start reading
- Returns:
- The shortvalue of the decodedbytearray
 
 - 
encodeIntpublic byte[] encodeInt(int value) Description copied from interface:DatatypeCoderEncode anintvalue as abytearray.- Specified by:
- encodeIntin interface- DatatypeCoder
- Parameters:
- value- The value to be encoded
- Returns:
- The value of valueencoded as abytearray
 
 - 
encodeIntpublic void encodeInt(int value, byte[] target, int fromIndex)Description copied from interface:DatatypeCoderEncode anintvalue into thetargetbyte array starting at indexfromIndex.- Specified by:
- encodeIntin interface- DatatypeCoder
- Parameters:
- value- The value to be encoded
- target- Target byte array of sufficient size
- fromIndex- Index to start writing
 
 - 
intToBytesprotected byte[] intToBytes(int value) Encode anintvalue as abytearray in network-order(big-endian) representation.- Parameters:
- value- The value to be encoded
- Returns:
- The value of valueencoded as abytearray
 
 - 
decodeIntpublic int decodeInt(byte[] byte_int) Description copied from interface:DatatypeCoderDecode abytearray into anintvalue.- Specified by:
- decodeIntin interface- DatatypeCoder
- Parameters:
- byte_int- The- bytearray to be decoded
- Returns:
- The intvalue of the decodedbytearray
 
 - 
decodeIntpublic int decodeInt(byte[] bytes, int fromIndex)Description copied from interface:DatatypeCoderDecode abytearray to anintvalue.- Specified by:
- decodeIntin interface- DatatypeCoder
- Parameters:
- bytes- The- bytearray to be decoded
- fromIndex- The index to start reading
- Returns:
- The intvalue of the decodedbytearray
 
 - 
encodeLongpublic byte[] encodeLong(long value) Description copied from interface:DatatypeCoderEncode alongvalue as abytearray.- Specified by:
- encodeLongin interface- DatatypeCoder
- Parameters:
- value- The value to be encoded
- Returns:
- The value of valueencoded as abytearray
 
 - 
decodeLongpublic long decodeLong(byte[] byte_int) Description copied from interface:DatatypeCoderDecode abytearray into alongvalue.- Specified by:
- decodeLongin interface- DatatypeCoder
- Parameters:
- byte_int- The- bytearray to be decoded
- Returns:
- The longvalue of the decodedbytearray
 
 - 
encodeFloatpublic byte[] encodeFloat(float value) Description copied from interface:DatatypeCoderEncode afloatvalue as abytearray.- Specified by:
- encodeFloatin interface- DatatypeCoder
- Parameters:
- value- The value to be encoded
- Returns:
- The value of valueencoded as abytearray
 
 - 
decodeFloatpublic float decodeFloat(byte[] byte_int) Description copied from interface:DatatypeCoderDecode abytearray into afloatvalue.- Specified by:
- decodeFloatin interface- DatatypeCoder
- Parameters:
- byte_int- The- bytearray to be decoded
- Returns:
- The floatvalue of the decodedbytearray
 
 - 
encodeDoublepublic byte[] encodeDouble(double value) Description copied from interface:DatatypeCoderEncode adoublevalue as abytearray.- Specified by:
- encodeDoublein interface- DatatypeCoder
- Parameters:
- value- The value to be encoded
- Returns:
- The value of valueencoded as abytearray
 
 - 
decodeDoublepublic double decodeDouble(byte[] byte_int) Description copied from interface:DatatypeCoderDecode abytearray into adoublevalue.- Specified by:
- decodeDoublein interface- DatatypeCoder
- Parameters:
- byte_int- The- bytearray to be decoded
- Returns:
- The doublevalue of the decodedbytearray
 
 - 
encodeStringpublic final byte[] encodeString(java.lang.String value) Description copied from interface:DatatypeCoderEncode aStringvalue into abytearray using the encoding of this datatype coder.- Specified by:
- encodeStringin interface- DatatypeCoder
- Parameters:
- value- The- Stringto be encoded
- Returns:
- The value of valueas abytearray
 
 - 
createWriterpublic final java.io.Writer createWriter(java.io.OutputStream outputStream) Description copied from interface:DatatypeCoderCreates a writer wrapping an input stream.- Specified by:
- createWriterin interface- DatatypeCoder
- Parameters:
- outputStream- Input stream
- Returns:
- Writer applying the encoding of this datatype when writing
 
 - 
decodeStringpublic final java.lang.String decodeString(byte[] value) Description copied from interface:DatatypeCoderDecode an encodedbytearray into aStringusing the encoding of this datatype coder.- Specified by:
- decodeStringin interface- DatatypeCoder
- Parameters:
- value- The value to be decoded
- Returns:
- The decoded String
 
 - 
createReaderpublic final java.io.Reader createReader(java.io.InputStream inputStream) Description copied from interface:DatatypeCoderCreates a reader wrapping an input stream.- Specified by:
- createReaderin interface- DatatypeCoder
- Parameters:
- inputStream- Input stream
- Returns:
- Reader applying the encoding of this datatype coder when reading
 
 - 
encodeTimestamppublic java.sql.Timestamp encodeTimestamp(java.sql.Timestamp value, java.util.Calendar cal)Description copied from interface:DatatypeCoderEncode aTimestampusing a givenCalendar.- Specified by:
- encodeTimestampin interface- DatatypeCoder
- Parameters:
- value- The- Timestampto be encoded
- cal- The- Calendarto be used for encoding, may be- null
 
 - 
encodeTimestamppublic java.sql.Timestamp encodeTimestamp(java.sql.Timestamp value, java.util.Calendar cal, boolean invertTimeZone)Description copied from interface:DatatypeCoderEncode aTimestampusing a givenCalendar.- Specified by:
- encodeTimestampin interface- DatatypeCoder
- Parameters:
- value- The- Timestampto be encoded
- cal- The- Calendarto be used for encoding, may be- null
- invertTimeZone- If- true, the timezone offset value will be subtracted from the encoded value, otherwise it will be added
- Returns:
- The encoded Timestamp
 
 - 
encodeTimestamppublic byte[] encodeTimestamp(java.sql.Timestamp value) Description copied from interface:DatatypeCoderEncode aTimestampas abytearray.- Specified by:
- encodeTimestampin interface- DatatypeCoder
- Parameters:
- value- The- Timestampto be encoded
- Returns:
- The array of bytes that represents the givenTimestampvalue
 
 - 
encodeTimestampRawpublic byte[] encodeTimestampRaw(DatatypeCoder.RawDateTimeStruct raw) Description copied from interface:DatatypeCoderEncode the date and time portions of a raw date time struct into abytearray.- Specified by:
- encodeTimestampRawin interface- DatatypeCoder
- Parameters:
- raw- The- RawDateTimeStructto be encoded
- Returns:
- The array of bytes representing the date and time of the givenRawDateTimeStruct
 
 - 
encodeTimestampCalendarpublic byte[] encodeTimestampCalendar(java.sql.Timestamp value, java.util.Calendar c)- Specified by:
- encodeTimestampCalendarin interface- DatatypeCoder
 
 - 
decodeTimestamppublic java.sql.Timestamp decodeTimestamp(java.sql.Timestamp value, java.util.Calendar cal)Description copied from interface:DatatypeCoderDecode aTimestampvalue using a givenCalendar.- Specified by:
- decodeTimestampin interface- DatatypeCoder
- Parameters:
- value- The- Timestampto be decoded
- cal- The- Calendarto be used in decoding, may be- null
- Returns:
- The decoded Timestamp
 
 - 
decodeTimestamppublic java.sql.Timestamp decodeTimestamp(java.sql.Timestamp value, java.util.Calendar cal, boolean invertTimeZone)Description copied from interface:DatatypeCoderDecode aTimestampvalue using a givenCalendar.- Specified by:
- decodeTimestampin interface- DatatypeCoder
- Parameters:
- value- The- Timestampto be decoded
- cal- The- Calendarto be used in decoding, may be- null
- invertTimeZone- If- true, the timezone offset value will be subtracted from the decoded value, otherwise it will be added
- Returns:
- The encoded Timestamp
 
 - 
decodeTimestamppublic java.sql.Timestamp decodeTimestamp(byte[] byte_long) Description copied from interface:DatatypeCoderDecode a 8-bytebytearray into aTimestamp.- Specified by:
- decodeTimestampin interface- DatatypeCoder
- Parameters:
- byte_long- The- bytearray to be decoded
- Returns:
- A Timestampvalue from the decoded bytes
 
 - 
decodeTimestampRawpublic DatatypeCoder.RawDateTimeStruct decodeTimestampRaw(byte[] byte_long) Description copied from interface:DatatypeCoderDecode a 8-bytebytearray into a raw date time struct.- Specified by:
- decodeTimestampRawin interface- DatatypeCoder
- Parameters:
- byte_long- The- bytearray to be decoded
- Returns:
- A DatatypeCoder.RawDateTimeStruct.
 
 - 
decodeTimestampCalendarpublic java.sql.Timestamp decodeTimestampCalendar(byte[] byte_long, java.util.Calendar c)- Specified by:
- decodeTimestampCalendarin interface- DatatypeCoder
 
 - 
encodeTimepublic java.sql.Time encodeTime(java.sql.Time d, java.util.Calendar cal, boolean invertTimeZone)Description copied from interface:DatatypeCoderEncode a givenTimevalue using a givenCalendar.- Specified by:
- encodeTimein interface- DatatypeCoder
- Parameters:
- d- The- Timeto be encoded
- cal- The- Calendarto be used in the encoding, may be- null
- Returns:
- The encoded Time
 
 - 
encodeTimepublic byte[] encodeTime(java.sql.Time d) Description copied from interface:DatatypeCoderEncode aTimevalue into abytearray.- Specified by:
- encodeTimein interface- DatatypeCoder
- Parameters:
- d- The- Timeto be encoded
- Returns:
- The array of bytes representing the givenTime
 
 - 
encodeTimeRawpublic byte[] encodeTimeRaw(DatatypeCoder.RawDateTimeStruct raw) Description copied from interface:DatatypeCoderEncode the time portion of a raw date time struct into abytearray.- Specified by:
- encodeTimeRawin interface- DatatypeCoder
- Parameters:
- raw- The- RawDateTimeStructto be encoded
- Returns:
- The array of bytes representing the time of the givenRawDateTimeStruct
 
 - 
encodeTimeCalendarpublic byte[] encodeTimeCalendar(java.sql.Time d, java.util.Calendar c)- Specified by:
- encodeTimeCalendarin interface- DatatypeCoder
 
 - 
decodeTimepublic java.sql.Time decodeTime(java.sql.Time d, java.util.Calendar cal, boolean invertTimeZone)Description copied from interface:DatatypeCoderDecode aTimevalue using a givenCalendar.- Specified by:
- decodeTimein interface- DatatypeCoder
- Parameters:
- d- The- Timeto be decoded
- cal- The- Calendarto be used in the decoding, may be- null
- Returns:
- The decooded Time
 
 - 
decodeTimepublic java.sql.Time decodeTime(byte[] int_byte) Description copied from interface:DatatypeCoderDecode abytearray into aTimevalue.- Specified by:
- decodeTimein interface- DatatypeCoder
- Parameters:
- int_byte- The- bytearray to be decoded
- Returns:
- The decoded Time
 
 - 
decodeTimeRawpublic DatatypeCoder.RawDateTimeStruct decodeTimeRaw(byte[] int_byte) Description copied from interface:DatatypeCoderDecode abytearray into a raw date time struct.- Specified by:
- decodeTimeRawin interface- DatatypeCoder
- Parameters:
- int_byte- The- bytearray to be decoded
- Returns:
- The DatatypeCoder.RawDateTimeStruct
 
 - 
decodeTimeCalendarpublic java.sql.Time decodeTimeCalendar(byte[] int_byte, java.util.Calendar c)- Specified by:
- decodeTimeCalendarin interface- DatatypeCoder
 
 - 
encodeDatepublic java.sql.Date encodeDate(java.sql.Date d, java.util.Calendar cal)Description copied from interface:DatatypeCoderEncode a givenDatevalue using a givenCalendar.- Specified by:
- encodeDatein interface- DatatypeCoder
- Parameters:
- d- The- Dateto be encoded
- cal- The- Calendarto be used in the encoding, may be- null
- Returns:
- The encoded Date
 
 - 
encodeDatepublic byte[] encodeDate(java.sql.Date d) Description copied from interface:DatatypeCoderEncode aDatevalue into abytearray.- Specified by:
- encodeDatein interface- DatatypeCoder
- Parameters:
- d- The- Dateto be encoded
- Returns:
- The array of bytes representing the givenDate
 
 - 
encodeDateRawpublic byte[] encodeDateRaw(DatatypeCoder.RawDateTimeStruct raw) Description copied from interface:DatatypeCoderEncode the date portion of a raw date time struct into abytearray.- Specified by:
- encodeDateRawin interface- DatatypeCoder
- Parameters:
- raw- The- RawDateTimeStructto be encoded
- Returns:
- The array of bytes representing the date of the givenRawDateTimeStruct
 
 - 
encodeDateCalendarpublic byte[] encodeDateCalendar(java.sql.Date d, java.util.Calendar c)- Specified by:
- encodeDateCalendarin interface- DatatypeCoder
 
 - 
decodeDatepublic java.sql.Date decodeDate(java.sql.Date d, java.util.Calendar cal)Description copied from interface:DatatypeCoderDecode aDatevalue using a givenCalendar.- Specified by:
- decodeDatein interface- DatatypeCoder
- Parameters:
- d- The- Dateto be decoded
- cal- The- Calendarto be used in the decoding, may be- null
- Returns:
- The decoded Date
 
 - 
decodeDatepublic java.sql.Date decodeDate(byte[] byte_int) Description copied from interface:DatatypeCoderDecode abytearray into aDatevalue.- Specified by:
- decodeDatein interface- DatatypeCoder
- Parameters:
- byte_int- The- bytearray to be decoded
- Returns:
- The decoded Date
 
 - 
decodeDateRawpublic DatatypeCoder.RawDateTimeStruct decodeDateRaw(byte[] byte_int) Description copied from interface:DatatypeCoderDecode abytearray into a raw date time struct.- Specified by:
- decodeDateRawin interface- DatatypeCoder
- Parameters:
- byte_int- The- bytearray to be decoded
- Returns:
- The DatatypeCoder.RawDateTimeStruct
 
 - 
decodeDateCalendarpublic java.sql.Date decodeDateCalendar(byte[] byte_int, java.util.Calendar c)- Specified by:
- decodeDateCalendarin interface- DatatypeCoder
 
 - 
decodeBooleanpublic boolean decodeBoolean(byte[] data) Description copied from interface:DatatypeCoderDecode boolean from supplied data.- Specified by:
- decodeBooleanin interface- DatatypeCoder
- Parameters:
- data- (expected) 1 bytes
- Returns:
- falsewhen 0,- truefor all other values
 
 - 
encodeBooleanpublic byte[] encodeBoolean(boolean value) Description copied from interface:DatatypeCoderEncodes boolean to 1 byte data.- Specified by:
- encodeBooleanin interface- DatatypeCoder
- Parameters:
- value- Boolean value to encode
- Returns:
- trueas 1,- falseas 0.
 
 - 
encodeLocalTimepublic byte[] encodeLocalTime(int hour, int minute, int second, int nanos)Description copied from interface:DatatypeCoderEncodes a java.time.LocalTime equivalent to time bytes.- Specified by:
- encodeLocalTimein interface- DatatypeCoder
- Parameters:
- hour- Number of hours (is assumed to be 0..23)
- minute- Number of minutes (is assumed to be 0..59)
- second- Number of seconds (is assumed to be 0..59)
- nanos- Sub-second nanoseconds (actual resolution is 100 microseconds, is assumed to be 0 .. 10^9 - 1 ns)
- Returns:
- Byte array for time
 
 - 
encodeLocalDatepublic byte[] encodeLocalDate(int year, int month, int day)Description copied from interface:DatatypeCoderEncodes a java.time.LocalDate equivalent to date bytes.- Specified by:
- encodeLocalDatein interface- DatatypeCoder
- Parameters:
- year- Year
- month- Month (is assumed to be 1..12)
- day- Day (is assumed to be valid for year and month)
- Returns:
- Byte array for date
 
 - 
encodeLocalDateTimepublic byte[] encodeLocalDateTime(int year, int month, int day, int hour, int minute, int second, int nanos)Description copied from interface:DatatypeCoderEncodes a java.time.LocalDateTime equivalent to timestamp bytes.- Specified by:
- encodeLocalDateTimein interface- DatatypeCoder
- Parameters:
- year- Year
- month- Month (is assumed to be 1..12)
- day- Day (is assumed to be valid for year and month)
- hour- Number of hours (is assumed to be 0..23)
- minute- Number of minutes (is assumed to be 0..59)
- second- Number of seconds (is assumed to be 0..59)
- nanos- Sub-second nanoseconds (actual resolution is 100 microseconds, is assumed to be 0 .. 10^9 - 1 ns)
- Returns:
- Byte array for timestamp
 
 - 
decodeDecimal64public Decimal64 decodeDecimal64(byte[] data) Description copied from interface:DatatypeCoderDecodes a decimal64 from byte array.- Specified by:
- decodeDecimal64in interface- DatatypeCoder
- Parameters:
- data- Data to decode (expected 8 bytes)
- Returns:
- Decimal64 value
 
 - 
encodeDecimal64public byte[] encodeDecimal64(Decimal64 decimal64) Description copied from interface:DatatypeCoderEncodes a decimal64 to a byte array.- Specified by:
- encodeDecimal64in interface- DatatypeCoder
- Parameters:
- decimal64- The decimal64 value to be encoded
- Returns:
- Byte array for decimal64 value
 
 - 
decodeDecimal128public Decimal128 decodeDecimal128(byte[] data) Description copied from interface:DatatypeCoderDecodes a decimal128 from byte array.- Specified by:
- decodeDecimal128in interface- DatatypeCoder
- Parameters:
- data- Data to decode (expected 16 bytes)
- Returns:
- Decimal128 value
 
 - 
encodeDecimal128public byte[] encodeDecimal128(Decimal128 decimal128) Description copied from interface:DatatypeCoderEncodes a decimal128 to a byte array.- Specified by:
- encodeDecimal128in interface- DatatypeCoder
- Parameters:
- decimal128- The decimal128 value to be encoded
- Returns:
- Byte array for decimal128 value
 
 - 
decodeInt128public java.math.BigInteger decodeInt128(byte[] data) Description copied from interface:DatatypeCoderDecodes a BigInteger from byte array.- Specified by:
- decodeInt128in interface- DatatypeCoder
- Parameters:
- data- Data to decode (expected 16 bytes)
- Returns:
- BigInteger value
 
 - 
encodeInt128public byte[] encodeInt128(java.math.BigInteger bigInteger) Description copied from interface:DatatypeCoderEncodes a BigInteger to a 16-byte byte array.The implementation expects to be passed a value that fits in 16 bytes. If a larger value is passed, and IllegalArgumentExceptionis thrown.- Specified by:
- encodeInt128in interface- DatatypeCoder
- Parameters:
- bigInteger- The BigInteger value to be encoded
- Returns:
- Byte array for bigInteger value
 
 - 
getEncodingFactorypublic final IEncodingFactory getEncodingFactory() - Specified by:
- getEncodingFactoryin interface- DatatypeCoder
- Returns:
- The encoding factory.
 
 - 
getEncodingDefinitionpublic final EncodingDefinition getEncodingDefinition() - Specified by:
- getEncodingDefinitionin interface- DatatypeCoder
- Returns:
- The encoding definition used by this datatype coder for string conversions.
 
 - 
getEncodingpublic final Encoding getEncoding() - Specified by:
- getEncodingin interface- DatatypeCoder
- Returns:
- The encoding used by this datatype coder for string conversions.
 
 - 
forEncodingDefinitionpublic final DatatypeCoder forEncodingDefinition(EncodingDefinition encodingDefinition) Description copied from interface:DatatypeCoderReturn a derived datatype coder that applies the supplied encoding definition for string conversions.- Specified by:
- forEncodingDefinitionin interface- DatatypeCoder
- Parameters:
- encodingDefinition- Encoding definition
- Returns:
- Derived datatype coder (may be this instance if encoding definition is the same)
 
 - 
unwrappublic DatatypeCoder unwrap() Description copied from interface:DatatypeCoderUnwrap this datatype coder to its parent (or itself).- Specified by:
- unwrapin interface- DatatypeCoder
- Returns:
- Return the parent of this datatype code, or itself if it has no parent.
 
 - 
equalspublic final boolean equals(java.lang.Object o) Description copied from interface:DatatypeCoderEquality: same basic type (ie: wire protocol/JNA type + endianness) and same encoding definition. This does not need to take into account the encoding factory, as usage should be limited to datatype coders derived from the same connection. - Specified by:
- equalsin interface- DatatypeCoder
- Overrides:
- equalsin class- java.lang.Object
- Parameters:
- o- Object to compare to
- Returns:
- trueif other is an equivalent datatype coder.
 
 - 
hashCodepublic final int hashCode() - Specified by:
- hashCodein interface- DatatypeCoder
- Overrides:
- hashCodein class- java.lang.Object
 
 
- 
 
-