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.DatatypeCoder

      `DatatypeCoder.RawDateTimeStruct`

  - ### Field Summary

    - ### Fields inherited from interface org.firebirdsql.gds.ng.DatatypeCoder

      `FRACTIONS_PER_HOUR, FRACTIONS_PER_MILLISECOND, FRACTIONS_PER_MINUTE, FRACTIONS_PER_SECOND, NANOSECONDS_PER_FRACTION`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultDatatypeCoder​(IEncodingFactory encodingFactory)` | Creates a default datatype coder for the wire protocol.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.io.Reader` | `createReader​(java.io.InputStream inputStream)` | Creates a reader wrapping an input stream.
    `java.io.Writer` | `createWriter​(java.io.OutputStream outputStream)` | Creates a writer wrapping an input stream.
    `boolean` | `decodeBoolean​(byte[] data)` | Decode boolean from supplied data.
    `java.sql.Date` | `decodeDate​(java.sql.Date d, java.util.Calendar cal)` | Decode a `Date` value using a given `Calendar`.
    `java.sql.Date` | `decodeDateCalendar​(byte[] byte_int, java.util.Calendar c)` | Decode a `byte` array into a `Date` value.
    `DatatypeCoder.RawDateTimeStruct` | `decodeDateRaw​(byte[] byte_int)` | Decode a `byte` array into a raw date time struct.
    `Decimal128` | `decodeDecimal128​(byte[] data)` | Decodes a decimal128 from byte array.
    `Decimal64` | `decodeDecimal64​(byte[] data)` | Decodes a decimal64 from byte array.
    `double` | `decodeDouble​(byte[] byte_int)` | Decode a `byte` array into a `double` value.
    `float` | `decodeFloat​(byte[] byte_int)` | Decode a `byte` array into a `float` value.
    `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.
    `java.time.LocalDate` | `decodeLocalDate​(byte[] data)` | Decode LocalDate from supplied data.
    `java.time.LocalDateTime` | `decodeLocalDateTime​(byte[] data)` | Decode LocalDateTime from supplied data.
    `java.time.LocalTime` | `decodeLocalTime​(byte[] data)` | Decode LocalTime from supplied data.
    `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.
    `java.lang.String` | `decodeString​(byte[] value)` | Decode an encoded `byte` array into a `String` using the encoding of this datatype coder.
    `java.sql.Time` | `decodeTime​(java.sql.Time d, java.util.Calendar cal, boolean invertTimeZone)` | Decode a `Time` value using a given `Calendar`.
    `java.sql.Time` | `decodeTimeCalendar​(byte[] int_byte, java.util.Calendar c)` | Decode a `byte` array into a `Time` value.
    `DatatypeCoder.RawDateTimeStruct` | `decodeTimeRaw​(byte[] int_byte)` | Decode a `byte` array into a raw date time struct.
    `java.sql.Timestamp` | `decodeTimestamp​(java.sql.Timestamp value, java.util.Calendar cal, boolean invertTimeZone)` | Decode a `Timestamp` value using a given `Calendar`.
    `java.sql.Timestamp` | `decodeTimestampCalendar​(byte[] byte_long, java.util.Calendar c)` | Decode an 8-byte `byte` array into a `Timestamp`.
    `DatatypeCoder.RawDateTimeStruct` | `decodeTimestampRaw​(byte[] byte_long)` | Decode an 8-byte `byte` array into a raw date time struct.
    `byte[]` | `encodeBoolean​(boolean value)` | Encodes boolean to 1 byte data.
    `java.sql.Date` | `encodeDate​(java.sql.Date d, java.util.Calendar cal)` | Encode a given `Date` value using a given `Calendar`.
    `byte[]` | `encodeDateCalendar​(java.sql.Date d, java.util.Calendar c)` | Encode a `Date` value into a `byte` array.
    `byte[]` | `encodeDateRaw​(DatatypeCoder.RawDateTimeStruct raw)` | Encode the date portion of a raw date time struct into a `byte` array.
    `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 a `double` value as a `byte` array.
    `byte[]` | `encodeFloat​(float value)` | Encode a `float` value as 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[]` | `encodeLocalDate​(java.time.LocalDate value)` | Encodes a java.time.LocalDate to date bytes.
    `byte[]` | `encodeLocalDateTime​(java.time.LocalDateTime value)` | Encodes a java.time.LocalDateTime to timestamp bytes.
    `byte[]` | `encodeLocalTime​(java.time.LocalTime value)` | Encodes a java.time.LocalTime to time bytes.
    `byte[]` | `encodeLong​(long value)` | Encode a `long` value as a `byte` array.
    `byte[]` | `encodeShort​(int value)` | Encode a `short` 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.
    `byte[]` | `encodeString​(java.lang.String value)` | Encode a `String` value into a `byte` array using the encoding of this datatype coder.
    `java.sql.Time` | `encodeTime​(java.sql.Time d, java.util.Calendar cal, boolean invertTimeZone)` | Encode a given `Time` value using a given `Calendar`.
    `byte[]` | `encodeTimeCalendar​(java.sql.Time d, java.util.Calendar c)` | Encode a `Time` value into a `byte` array.
    `byte[]` | `encodeTimeRaw​(DatatypeCoder.RawDateTimeStruct raw)` | Encode the time portion of a raw date time struct into a `byte` array.
    `java.sql.Timestamp` | `encodeTimestamp​(java.sql.Timestamp value, java.util.Calendar cal, boolean invertTimeZone)` | Encode a `Timestamp` using a given `Calendar`.
    `byte[]` | `encodeTimestampCalendar​(java.sql.Timestamp value, java.util.Calendar c)` | Encode a `Timestamp` as a `byte` array.
    `byte[]` | `encodeTimestampRaw​(DatatypeCoder.RawDateTimeStruct raw)` | Encode the date and time portions of a raw date time struct into a `byte` array.
    `boolean` | `equals​(java.lang.Object o)`
    `DatatypeCoder` | `forEncodingDefinition​(EncodingDefinition encodingDefinition)` | Return a derived datatype coder that applies the supplied encoding definition for string conversions.
    `static DefaultDatatypeCoder` | `forEncodingFactory​(IEncodingFactory encodingFactory)` | Returns an instance of `DefaultDatatypeCoder` for an encoding factory.
    `Encoding` | `getEncoding()` |
    `EncodingDefinition` | `getEncodingDefinition()` |
    `IEncodingFactory` | `getEncodingFactory()` |
    `int` | `hashCode()` |
    `protected byte[]` | `intToBytes​(int value)` | Encode an `int` value as a `byte` array in network-order(big-endian) representation.
    `int` | `sizeOfShort()` | The size of an encoded short in this data type coder.
    `DatatypeCoder` | `unwrap()` | Unwrap this datatype coder to its parent (or itself).

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultDatatypeCoder

          public 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

    - #### forEncodingFactory

          public static DefaultDatatypeCoder forEncodingFactory​(IEncodingFactory encodingFactory)

      Returns an instance of `DefaultDatatypeCoder` for an encoding factory.
      Parameters:
        `encodingFactory` - Encoding factory
      Returns:
        Datatype coder, this might be a cached instance

    - #### sizeOfShort

          public int sizeOfShort()

      Description copied from interface: `DatatypeCoder`
      The size of an encoded short in this data type coder.
      Specified by:
        `sizeOfShort` in interface `DatatypeCoder`
      Returns:
        The size of an encoded short (either `2` or `4` bytes)

    - #### encodeShort

          public byte[] encodeShort​(short value)

      Description copied from interface: `DatatypeCoder`
      Encode a `short` value as a `byte` array.
      Specified by:
        `encodeShort` in interface `DatatypeCoder`
      Parameters:
        `value` - The value to be encoded
      Returns:
        The value of `value` encoded as a `byte` array
      See Also:
        `DatatypeCoder.encodeShort(int)`

    - #### encodeShort

          public byte[] encodeShort​(int value)

      Description copied from interface: `DatatypeCoder`
      Encode a `short` value as a `byte` array.
      Specified by:
        `encodeShort` in interface `DatatypeCoder`
      Parameters:
        `value` - The value to be encoded
      Returns:
        The value of `value` encoded as a `byte` array

    - #### encodeShort

          public void encodeShort​(int value,
                                  byte[] target,
                                  int fromIndex)

      Description copied from interface: `DatatypeCoder`
      Encode a `short` value into the `target` byte array starting at index `fromIndex`.
      Specified by:
        `encodeShort` in 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

    - #### decodeShort

          public short decodeShort​(byte[] byte_int)

      Description copied from interface: `DatatypeCoder`
      Decode a `byte` array into a `short` value.
      Specified by:
        `decodeShort` in interface `DatatypeCoder`
      Parameters:
        `byte_int` - The `byte` array to be decoded
      Returns:
        The `short` value of the decoded `byte` array

    - #### decodeShort

          public short decodeShort​(byte[] bytes,
                                   int fromIndex)

      Description copied from interface: `DatatypeCoder`
      Decode from a `byte` array to a `short` value.
      Specified by:
        `decodeShort` in interface `DatatypeCoder`
      Parameters:
        `bytes` - The `byte` array to be decoded
        `fromIndex` - The index to start reading
      Returns:
        The `short` value of the decoded `byte` array

    - #### encodeInt

          public byte[] encodeInt​(int value)

      Description copied from interface: `DatatypeCoder`
      Encode an `int` value as a `byte` array.
      Specified by:
        `encodeInt` in interface `DatatypeCoder`
      Parameters:
        `value` - The value to be encoded
      Returns:
        The value of `value` encoded as a `byte` array

    - #### encodeInt

          public void encodeInt​(int value,
                                byte[] target,
                                int fromIndex)

      Description copied from interface: `DatatypeCoder`
      Encode an `int` value into the `target` byte array starting at index `fromIndex`.
      Specified by:
        `encodeInt` in interface `DatatypeCoder`
      Parameters:
        `value` - The value to be encoded
        `target` - Target byte array of sufficient size
        `fromIndex` - Index to start writing

    - #### intToBytes

          protected byte[] intToBytes​(int value)

      Encode an `int` value as a `byte` array in network-order(big-endian) representation.
      Parameters:
        `value` - The value to be encoded
      Returns:
        The value of `value` encoded as a `byte` array

    - #### decodeInt

          public int decodeInt​(byte[] byte_int)

      Description copied from interface: `DatatypeCoder`
      Decode a `byte` array into an `int` value.
      Specified by:
        `decodeInt` in interface `DatatypeCoder`
      Parameters:
        `byte_int` - The `byte` array to be decoded
      Returns:
        The `int` value of the decoded `byte` array

    - #### decodeInt

          public int decodeInt​(byte[] bytes,
                               int fromIndex)

      Description copied from interface: `DatatypeCoder`
      Decode a `byte` array to an `int` value.
      Specified by:
        `decodeInt` in interface `DatatypeCoder`
      Parameters:
        `bytes` - The `byte` array to be decoded
        `fromIndex` - The index to start reading
      Returns:
        The `int` value of the decoded `byte` array

    - #### encodeLong

          public byte[] encodeLong​(long value)

      Description copied from interface: `DatatypeCoder`
      Encode a `long` value as a `byte` array.
      Specified by:
        `encodeLong` in interface `DatatypeCoder`
      Parameters:
        `value` - The value to be encoded
      Returns:
        The value of `value` encoded as a `byte` array

    - #### decodeLong

          public long decodeLong​(byte[] byte_int)

      Description copied from interface: `DatatypeCoder`
      Decode a `byte` array into a `long` value.
      Specified by:
        `decodeLong` in interface `DatatypeCoder`
      Parameters:
        `byte_int` - The `byte` array to be decoded
      Returns:
        The `long` value of the decoded `byte` array

    - #### encodeFloat

          public byte[] encodeFloat​(float value)

      Description copied from interface: `DatatypeCoder`
      Encode a `float` value as a `byte` array.
      Specified by:
        `encodeFloat` in interface `DatatypeCoder`
      Parameters:
        `value` - The value to be encoded
      Returns:
        The value of `value` encoded as a `byte` array

    - #### decodeFloat

          public float decodeFloat​(byte[] byte_int)

      Description copied from interface: `DatatypeCoder`
      Decode a `byte` array into a `float` value.
      Specified by:
        `decodeFloat` in interface `DatatypeCoder`
      Parameters:
        `byte_int` - The `byte` array to be decoded
      Returns:
        The `float` value of the decoded `byte` array

    - #### encodeDouble

          public byte[] encodeDouble​(double value)

      Description copied from interface: `DatatypeCoder`
      Encode a `double` value as a `byte` array.
      Specified by:
        `encodeDouble` in interface `DatatypeCoder`
      Parameters:
        `value` - The value to be encoded
      Returns:
        The value of `value` encoded as a `byte` array

    - #### decodeDouble

          public double decodeDouble​(byte[] byte_int)

      Description copied from interface: `DatatypeCoder`
      Decode a `byte` array into a `double` value.
      Specified by:
        `decodeDouble` in interface `DatatypeCoder`
      Parameters:
        `byte_int` - The `byte` array to be decoded
      Returns:
        The `double` value of the decoded `byte` array

    - #### encodeString

          public final byte[] encodeString​(java.lang.String value)

      Description copied from interface: `DatatypeCoder`
      Encode a `String` value into a `byte` array using the encoding of this datatype coder.
      Specified by:
        `encodeString` in interface `DatatypeCoder`
      Parameters:
        `value` - The `String` to be encoded
      Returns:
        The value of `value` as a `byte` array

    - #### createWriter

          public final java.io.Writer createWriter​(java.io.OutputStream outputStream)

      Description copied from interface: `DatatypeCoder`
      Creates a writer wrapping an input stream.
      Specified by:
        `createWriter` in interface `DatatypeCoder`
      Parameters:
        `outputStream` - Input stream
      Returns:
        Writer applying the encoding of this datatype when writing

    - #### decodeString

          public final java.lang.String decodeString​(byte[] value)

      Description copied from interface: `DatatypeCoder`
      Decode an encoded `byte` array into a `String` using the encoding of this datatype coder.
      Specified by:
        `decodeString` in interface `DatatypeCoder`
      Parameters:
        `value` - The value to be decoded
      Returns:
        The decoded `String`

    - #### createReader

          public final java.io.Reader createReader​(java.io.InputStream inputStream)

      Description copied from interface: `DatatypeCoder`
      Creates a reader wrapping an input stream.
      Specified by:
        `createReader` in interface `DatatypeCoder`
      Parameters:
        `inputStream` - Input stream
      Returns:
        Reader applying the encoding of this datatype coder when reading

    - #### encodeTimestamp

          public java.sql.Timestamp encodeTimestamp​(java.sql.Timestamp value,
                                                    java.util.Calendar cal,
                                                    boolean invertTimeZone)

      Description copied from interface: `DatatypeCoder`
      Encode a `Timestamp` using a given `Calendar`.
      Specified by:
        `encodeTimestamp` in interface `DatatypeCoder`
      Parameters:
        `value` - The `Timestamp` to be encoded
        `cal` - The `Calendar` to 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`

    - #### encodeTimestampRaw

          public byte[] encodeTimestampRaw​(DatatypeCoder.RawDateTimeStruct raw)

      Description copied from interface: `DatatypeCoder`
      Encode the date and time portions of a raw date time struct into a `byte` array.
      Specified by:
        `encodeTimestampRaw` in interface `DatatypeCoder`
      Parameters:
        `raw` - The `RawDateTimeStruct` to be encoded
      Returns:
        The array of `byte`s representing the date and time of the given `RawDateTimeStruct`

    - #### encodeTimestampCalendar

          public byte[] encodeTimestampCalendar​(java.sql.Timestamp value,
                                                java.util.Calendar c)

      Description copied from interface: `DatatypeCoder`
      Encode a `Timestamp` as a `byte` array.
      Specified by:
        `encodeTimestampCalendar` in interface `DatatypeCoder`
      Parameters:
        `value` - The `Timestamp` to be encoded
        `c` - Calendar to use for time zone calculation
      Returns:
        The array of `byte`s that represents the given `Timestamp` value

    - #### decodeTimestamp

          public java.sql.Timestamp decodeTimestamp​(java.sql.Timestamp value,
                                                    java.util.Calendar cal,
                                                    boolean invertTimeZone)

      Description copied from interface: `DatatypeCoder`
      Decode a `Timestamp` value using a given `Calendar`.
      Specified by:
        `decodeTimestamp` in interface `DatatypeCoder`
      Parameters:
        `value` - The `Timestamp` to be decoded
        `cal` - The `Calendar` to 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`

    - #### decodeTimestampRaw

          public DatatypeCoder.RawDateTimeStruct decodeTimestampRaw​(byte[] byte_long)

      Description copied from interface: `DatatypeCoder`
      Decode an 8-byte `byte` array into a raw date time struct.
      Specified by:
        `decodeTimestampRaw` in interface `DatatypeCoder`
      Parameters:
        `byte_long` - The `byte` array to be decoded
      Returns:
        A `DatatypeCoder.RawDateTimeStruct`.

    - #### decodeTimestampCalendar

          public java.sql.Timestamp decodeTimestampCalendar​(byte[] byte_long,
                                                            java.util.Calendar c)

      Description copied from interface: `DatatypeCoder`
      Decode an 8-byte `byte` array into a `Timestamp`.
      Specified by:
        `decodeTimestampCalendar` in interface `DatatypeCoder`
      Parameters:
        `byte_long` - The `byte` array to be decoded
        `c` - Calendar to use for time zone calculation
      Returns:
        A `Timestamp` value from the decoded bytes

    - #### encodeTime

          public java.sql.Time encodeTime​(java.sql.Time d,
                                          java.util.Calendar cal,
                                          boolean invertTimeZone)

      Description copied from interface: `DatatypeCoder`
      Encode a given `Time` value using a given `Calendar`.
      Specified by:
        `encodeTime` in interface `DatatypeCoder`
      Parameters:
        `d` - The `Time` to be encoded
        `cal` - The `Calendar` to be used in the encoding, may be `null`
      Returns:
        The encoded `Time`

    - #### encodeTimeRaw

          public byte[] encodeTimeRaw​(DatatypeCoder.RawDateTimeStruct raw)

      Description copied from interface: `DatatypeCoder`
      Encode the time portion of a raw date time struct into a `byte` array.
      Specified by:
        `encodeTimeRaw` in interface `DatatypeCoder`
      Parameters:
        `raw` - The `RawDateTimeStruct` to be encoded
      Returns:
        The array of `byte`s representing the time of the given `RawDateTimeStruct`

    - #### encodeTimeCalendar

          public byte[] encodeTimeCalendar​(java.sql.Time d,
                                           java.util.Calendar c)

      Description copied from interface: `DatatypeCoder`
      Encode a `Time` value into a `byte` array.
      Specified by:
        `encodeTimeCalendar` in interface `DatatypeCoder`
      Parameters:
        `d` - The `Time` to be encoded
        `c` - Calendar to use for time zone calculation
      Returns:
        The array of `byte`s representing the given `Time`

    - #### decodeTime

          public java.sql.Time decodeTime​(java.sql.Time d,
                                          java.util.Calendar cal,
                                          boolean invertTimeZone)

      Description copied from interface: `DatatypeCoder`
      Decode a `Time` value using a given `Calendar`.
      Specified by:
        `decodeTime` in interface `DatatypeCoder`
      Parameters:
        `d` - The `Time` to be decoded
        `cal` - The `Calendar` to be used in the decoding, may be `null`
      Returns:
        The decoded `Time`

    - #### decodeTimeRaw

          public DatatypeCoder.RawDateTimeStruct decodeTimeRaw​(byte[] int_byte)

      Description copied from interface: `DatatypeCoder`
      Decode a `byte` array into a raw date time struct.
      Specified by:
        `decodeTimeRaw` in interface `DatatypeCoder`
      Parameters:
        `int_byte` - The `byte` array to be decoded
      Returns:
        The `DatatypeCoder.RawDateTimeStruct`

    - #### decodeTimeCalendar

          public java.sql.Time decodeTimeCalendar​(byte[] int_byte,
                                                  java.util.Calendar c)

      Description copied from interface: `DatatypeCoder`
      Decode a `byte` array into a `Time` value.
      Specified by:
        `decodeTimeCalendar` in interface `DatatypeCoder`
      Parameters:
        `int_byte` - The `byte` array to be decoded
        `c` - Calendar to use for time zone calculation
      Returns:
        The decoded `Time`

    - #### encodeDate

          public java.sql.Date encodeDate​(java.sql.Date d,
                                          java.util.Calendar cal)

      Description copied from interface: `DatatypeCoder`
      Encode a given `Date` value using a given `Calendar`.
      Specified by:
        `encodeDate` in interface `DatatypeCoder`
      Parameters:
        `d` - The `Date` to be encoded
        `cal` - The `Calendar` to be used in the encoding, may be `null`
      Returns:
        The encoded `Date`

    - #### encodeDateRaw

          public byte[] encodeDateRaw​(DatatypeCoder.RawDateTimeStruct raw)

      Description copied from interface: `DatatypeCoder`
      Encode the date portion of a raw date time struct into a `byte` array.
      Specified by:
        `encodeDateRaw` in interface `DatatypeCoder`
      Parameters:
        `raw` - The `RawDateTimeStruct` to be encoded
      Returns:
        The array of `byte`s representing the date of the given `RawDateTimeStruct`

    - #### encodeDateCalendar

          public byte[] encodeDateCalendar​(java.sql.Date d,
                                           java.util.Calendar c)

      Description copied from interface: `DatatypeCoder`
      Encode a `Date` value into a `byte` array.
      Specified by:
        `encodeDateCalendar` in interface `DatatypeCoder`
      Parameters:
        `d` - The `Date` to be encoded
        `c` - Calendar to use for time zone calculation
      Returns:
        The array of `byte`s representing the given `Date`

    - #### decodeDate

          public java.sql.Date decodeDate​(java.sql.Date d,
                                          java.util.Calendar cal)

      Description copied from interface: `DatatypeCoder`
      Decode a `Date` value using a given `Calendar`.
      Specified by:
        `decodeDate` in interface `DatatypeCoder`
      Parameters:
        `d` - The `Date` to be decoded
        `cal` - The `Calendar` to be used in the decoding, may be `null`
      Returns:
        The decoded `Date`

    - #### decodeDateRaw

          public DatatypeCoder.RawDateTimeStruct decodeDateRaw​(byte[] byte_int)

      Description copied from interface: `DatatypeCoder`
      Decode a `byte` array into a raw date time struct.
      Specified by:
        `decodeDateRaw` in interface `DatatypeCoder`
      Parameters:
        `byte_int` - The `byte` array to be decoded
      Returns:
        The `DatatypeCoder.RawDateTimeStruct`

    - #### decodeDateCalendar

          public java.sql.Date decodeDateCalendar​(byte[] byte_int,
                                                  java.util.Calendar c)

      Description copied from interface: `DatatypeCoder`
      Decode a `byte` array into a `Date` value.
      Specified by:
        `decodeDateCalendar` in interface `DatatypeCoder`
      Parameters:
        `byte_int` - The `byte` array to be decoded
        `c` - Calendar to use for time zone calculation
      Returns:
        The decoded `Date`

    - #### decodeBoolean

          public boolean decodeBoolean​(byte[] data)

      Description copied from interface: `DatatypeCoder`
      Decode boolean from supplied data.
      Specified by:
        `decodeBoolean` in interface `DatatypeCoder`
      Parameters:
        `data` - (expected) 1 bytes
      Returns:
        `false` when 0, `true` for all other values

    - #### encodeBoolean

          public byte[] encodeBoolean​(boolean value)

      Description copied from interface: `DatatypeCoder`
      Encodes boolean to 1 byte data.
      Specified by:
        `encodeBoolean` in interface `DatatypeCoder`
      Parameters:
        `value` - Boolean value to encode
      Returns:
        `true` as 1, `false` as 0.

    - #### decodeLocalTime

          public java.time.LocalTime decodeLocalTime​(byte[] data)

      Description copied from interface: `DatatypeCoder`
      Decode LocalTime from supplied data.
      Specified by:
        `decodeLocalTime` in interface `DatatypeCoder`
      Parameters:
        `data` - (expected) 4 bytes
      Returns:
        LocalTime value

    - #### encodeLocalTime

          public byte[] encodeLocalTime​(java.time.LocalTime value)

      Description copied from interface: `DatatypeCoder`
      Encodes a java.time.LocalTime to time bytes.
      Specified by:
        `encodeLocalTime` in interface `DatatypeCoder`
      Parameters:
        `value` - LocalTime value to encode
      Returns:
        Byte array for time

    - #### decodeLocalDate

          public java.time.LocalDate decodeLocalDate​(byte[] data)

      Description copied from interface: `DatatypeCoder`
      Decode LocalDate from supplied data.
      Specified by:
        `decodeLocalDate` in interface `DatatypeCoder`
      Parameters:
        `data` - (expected) 4 bytes
      Returns:
        LocalDate value

    - #### encodeLocalDate

          public byte[] encodeLocalDate​(java.time.LocalDate value)

      Description copied from interface: `DatatypeCoder`
      Encodes a java.time.LocalDate to date bytes.
      Specified by:
        `encodeLocalDate` in interface `DatatypeCoder`
      Parameters:
        `value` - LocalDate to encode
      Returns:
        Byte array for date

    - #### decodeLocalDateTime

          public java.time.LocalDateTime decodeLocalDateTime​(byte[] data)

      Description copied from interface: `DatatypeCoder`
      Decode LocalDateTime from supplied data.
      Specified by:
        `decodeLocalDateTime` in interface `DatatypeCoder`
      Parameters:
        `data` - (expected) 8 bytes
      Returns:
        LocalDateTime value

    - #### encodeLocalDateTime

          public byte[] encodeLocalDateTime​(java.time.LocalDateTime value)

      Description copied from interface: `DatatypeCoder`
      Encodes a java.time.LocalDateTime to timestamp bytes.
      Specified by:
        `encodeLocalDateTime` in interface `DatatypeCoder`
      Parameters:
        `value` - LocalDateTime to encode
      Returns:
        Byte array for date

    - #### decodeDecimal64

          public Decimal64 decodeDecimal64​(byte[] data)

      Description copied from interface: `DatatypeCoder`
      Decodes a decimal64 from byte array.
      Specified by:
        `decodeDecimal64` in interface `DatatypeCoder`
      Parameters:
        `data` - Data to decode (expected 8 bytes)
      Returns:
        Decimal64 value

    - #### encodeDecimal64

          public byte[] encodeDecimal64​(Decimal64 decimal64)

      Description copied from interface: `DatatypeCoder`
      Encodes a decimal64 to a byte array.
      Specified by:
        `encodeDecimal64` in interface `DatatypeCoder`
      Parameters:
        `decimal64` - The decimal64 value to be encoded
      Returns:
        Byte array for decimal64 value

    - #### decodeDecimal128

          public Decimal128 decodeDecimal128​(byte[] data)

      Description copied from interface: `DatatypeCoder`
      Decodes a decimal128 from byte array.
      Specified by:
        `decodeDecimal128` in interface `DatatypeCoder`
      Parameters:
        `data` - Data to decode (expected 16 bytes)
      Returns:
        Decimal128 value

    - #### encodeDecimal128

          public byte[] encodeDecimal128​(Decimal128 decimal128)

      Description copied from interface: `DatatypeCoder`
      Encodes a decimal128 to a byte array.
      Specified by:
        `encodeDecimal128` in interface `DatatypeCoder`
      Parameters:
        `decimal128` - The decimal128 value to be encoded
      Returns:
        Byte array for decimal128 value

    - #### decodeInt128

          public java.math.BigInteger decodeInt128​(byte[] data)

      Description copied from interface: `DatatypeCoder`
      Decodes a BigInteger from byte array.
      Specified by:
        `decodeInt128` in interface `DatatypeCoder`
      Parameters:
        `data` - Data to decode (expected 16 bytes)
      Returns:
        BigInteger value

    - #### encodeInt128

          public byte[] encodeInt128​(java.math.BigInteger bigInteger)

      Description copied from interface: `DatatypeCoder`
      Encodes 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 `IllegalArgumentException` is thrown.

      Specified by:
        `encodeInt128` in interface `DatatypeCoder`
      Parameters:
        `bigInteger` - The BigInteger value to be encoded
      Returns:
        Byte array for bigInteger value

    - #### getEncodingFactory

          public final IEncodingFactory getEncodingFactory()

      Specified by:
        `getEncodingFactory` in interface `DatatypeCoder`
      Returns:
        The encoding factory.

    - #### getEncodingDefinition

          public final EncodingDefinition getEncodingDefinition()

      Specified by:
        `getEncodingDefinition` in interface `DatatypeCoder`
      Returns:
        The encoding definition used by this datatype coder for string conversions.

    - #### getEncoding

          public final Encoding getEncoding()

      Specified by:
        `getEncoding` in interface `DatatypeCoder`
      Returns:
        The encoding used by this datatype coder for string conversions.

    - #### forEncodingDefinition

          public final DatatypeCoder forEncodingDefinition​(EncodingDefinition encodingDefinition)

      Description copied from interface: `DatatypeCoder`
      Return a derived datatype coder that applies the supplied encoding definition for string conversions.
      Specified by:
        `forEncodingDefinition` in interface `DatatypeCoder`
      Parameters:
        `encodingDefinition` - Encoding definition
      Returns:
        Derived datatype coder (this instance, if encoding definition is the same)

    - #### unwrap

          public DatatypeCoder unwrap()

      Description copied from interface: `DatatypeCoder`
      Unwrap this datatype coder to its parent (or itself).
      Specified by:
        `unwrap` in interface `DatatypeCoder`
      Returns:
        Return the parent of this datatype code, or itself if it has no parent.

    - #### equals

          public final boolean equals​(java.lang.Object o)

      Description copied from interface: `DatatypeCoder`

      Equality: 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:
        `equals` in interface `DatatypeCoder`
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `o` - Object to compare to
      Returns:
        `true` if other is an equivalent datatype coder.

    - #### hashCode

          public final int hashCode()

      Specified by:
        `hashCode` in interface `DatatypeCoder`
      Overrides:
        `hashCode` in class `java.lang.Object`