Class LittleEndianDatatypeCoder

java.lang.Object
org.firebirdsql.gds.ng.DefaultDatatypeCoder
org.firebirdsql.gds.ng.jna.LittleEndianDatatypeCoder
All Implemented Interfaces:
org.firebirdsql.gds.ng.DatatypeCoder

public final class LittleEndianDatatypeCoder extends org.firebirdsql.gds.ng.DefaultDatatypeCoder
Datatype encoder and decoder for little endian platforms, specifically for use with the Firebird client library.

For wire protocol use DefaultDatatypeCoder.

Since:
3
Author:
Mark Rotteveel
  • 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
    LittleEndianDatatypeCoder(org.firebirdsql.encodings.IEncodingFactory encodingFactory)
    Creates a little-endian datatype coder for native access on little-endian platforms.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    decodeInt(byte[] buf, int off)
     
    long
    decodeLong(byte[] buf)
     
    short
    decodeShort(byte[] buf, int off)
     
    void
    encodeInt(int val, byte[] buf, int off)
     
    byte[]
    encodeLong(long val)
     
    void
    encodeShort(int val, byte[] buf, int off)
     
    forEncodingFactory(org.firebirdsql.encodings.IEncodingFactory encodingFactory)
    Returns an instance of LittleEndianDatatypeCoder for an encoding factory.
    protected byte[]
    networkOrder(byte[] buf)
     
    int
     

    Methods inherited from class org.firebirdsql.gds.ng.DefaultDatatypeCoder

    createReader, createWriter, decodeBoolean, decodeDecimal128, decodeDecimal64, decodeDouble, decodeFloat, decodeInt, decodeInt128, decodeLocalDate, decodeLocalDate, decodeLocalDateTime, decodeLocalDateTime, decodeLocalTime, decodeLocalTime, decodeShort, decodeString, encodeBoolean, encodeDecimal128, encodeDecimal64, encodeDouble, encodeFloat, encodeInt, encodeInt128, encodeLocalDate, encodeLocalDate, encodeLocalDateTime, encodeLocalDateTime, encodeLocalTime, encodeLocalTime, encodeShort, encodeShort, encodeString, equals, forEncodingDefinition, getEncoding, getEncodingDefinition, getEncodingFactory, hashCode, unwrap

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LittleEndianDatatypeCoder

      public LittleEndianDatatypeCoder(org.firebirdsql.encodings.IEncodingFactory encodingFactory)
      Creates a little-endian datatype coder for native access on little-endian platforms.

      In almost all cases, it is better to use forEncodingFactory(IEncodingFactory).

      Parameters:
      encodingFactory - encoding factory
  • Method Details

    • forEncodingFactory

      public static LittleEndianDatatypeCoder forEncodingFactory(org.firebirdsql.encodings.IEncodingFactory encodingFactory)
      Returns an instance of LittleEndianDatatypeCoder for an encoding factory.
      Parameters:
      encodingFactory - encoding factory
      Returns:
      datatype coder, this might be a cached instance
    • sizeOfShort

      public int sizeOfShort()
      Specified by:
      sizeOfShort in interface org.firebirdsql.gds.ng.DatatypeCoder
      Overrides:
      sizeOfShort in class org.firebirdsql.gds.ng.DefaultDatatypeCoder
    • encodeShort

      public void encodeShort(int val, byte[] buf, int off)
      Specified by:
      encodeShort in interface org.firebirdsql.gds.ng.DatatypeCoder
      Overrides:
      encodeShort in class org.firebirdsql.gds.ng.DefaultDatatypeCoder
    • decodeShort

      public short decodeShort(byte[] buf, int off)
      Specified by:
      decodeShort in interface org.firebirdsql.gds.ng.DatatypeCoder
      Overrides:
      decodeShort in class org.firebirdsql.gds.ng.DefaultDatatypeCoder
    • encodeInt

      public void encodeInt(int val, byte[] buf, int off)
      Specified by:
      encodeInt in interface org.firebirdsql.gds.ng.DatatypeCoder
      Overrides:
      encodeInt in class org.firebirdsql.gds.ng.DefaultDatatypeCoder
    • decodeInt

      public int decodeInt(byte[] buf, int off)
      Specified by:
      decodeInt in interface org.firebirdsql.gds.ng.DatatypeCoder
      Overrides:
      decodeInt in class org.firebirdsql.gds.ng.DefaultDatatypeCoder
    • encodeLong

      public byte[] encodeLong(long val)
      Specified by:
      encodeLong in interface org.firebirdsql.gds.ng.DatatypeCoder
      Overrides:
      encodeLong in class org.firebirdsql.gds.ng.DefaultDatatypeCoder
    • decodeLong

      public long decodeLong(byte[] buf)
      Specified by:
      decodeLong in interface org.firebirdsql.gds.ng.DatatypeCoder
      Overrides:
      decodeLong in class org.firebirdsql.gds.ng.DefaultDatatypeCoder
    • networkOrder

      protected byte[] networkOrder(byte[] buf)
      Overrides:
      networkOrder in class org.firebirdsql.gds.ng.DefaultDatatypeCoder