Class ArrayEncoding.FixedSizePrimitiveArrayEncoder<A>

    • Field Detail

      • fieldSize

        private final int fieldSize
    • Constructor Detail

      • FixedSizePrimitiveArrayEncoder

        FixedSizePrimitiveArrayEncoder​(int fieldSize,
                                       int oid,
                                       int arrayOid)
    • Method Detail

      • countNulls

        final int countNulls​(A array)
        Counts the number of null elements in array.

        Always returns 0.

        Overrides:
        countNulls in class ArrayEncoding.AbstractArrayEncoder<A>
        Parameters:
        array - The array to count null elements in.
        Returns:
        The number of null elements in array.
      • toBinaryRepresentation

        public final byte[] toBinaryRepresentation​(BaseConnection connection,
                                                   A array,
                                                   int oid)
                                            throws java.sql.SQLException,
                                                   java.sql.SQLFeatureNotSupportedException
        Creates binary representation of the array.
        Parameters:
        connection - The connection the binary representation will be used on. Attributes from the connection might impact how values are translated to binary.
        array - The array to binary encode. Must not be null, but may contain null elements.
        oid - The array type oid to use. Calls to ArrayEncoding.ArrayEncoder.supportBinaryRepresentation(int) must have returned true.
        Returns:
        The binary representation of array.
        Throws:
        java.sql.SQLFeatureNotSupportedException - If ArrayEncoding.ArrayEncoder.supportBinaryRepresentation(int) is false for oid.
        java.sql.SQLException
      • write

        protected abstract void write​(A array,
                                      byte[] bytes,
                                      int offset)
        Write the entire contents of array to bytes starting at offset without metadata describing type or length.
        Parameters:
        array - The array to write.
        bytes - The byte[] to write to.
        offset - The offset into bytes to start writing.