Class ArrayEncoding.AbstractArrayEncoder<A>

    • Field Detail

      • oid

        private final int oid
      • arrayOid

        final int arrayOid
    • Constructor Detail

      • AbstractArrayEncoder

        AbstractArrayEncoder​(int oid,
                             int arrayOid)
        Parameters:
        oid - The default/primary base oid type.
        arrayOid - The default/primary array oid type.
    • Method Detail

      • getDefaultArrayTypeOid

        public int getDefaultArrayTypeOid()
        By default returns the arrayOid this instance was instantiated with.
        Specified by:
        getDefaultArrayTypeOid in interface ArrayEncoding.ArrayEncoder<A>
        Returns:
        The default array type oid supported by this instance.
      • countNulls

        int countNulls​(A array)
        Counts the number of null elements in array.
        Parameters:
        array - The array to count null elements in.
        Returns:
        The number of null elements in array.
      • toSingleDimensionBinaryRepresentation

        abstract byte[] toSingleDimensionBinaryRepresentation​(BaseConnection connection,
                                                              A array)
                                                       throws java.sql.SQLException,
                                                              java.sql.SQLFeatureNotSupportedException
        Creates byte[] of just the raw data (no metadata).
        Parameters:
        connection - The connection the binary representation will be used on.
        array - The array to create binary representation of. Will not be null, but may contain null elements.
        Returns:
        byte[] of just the raw data (no metadata).
        Throws:
        java.sql.SQLFeatureNotSupportedException - If supportBinaryRepresentation(int) is false for oid.
        java.sql.SQLException
      • toArrayString

        public java.lang.String toArrayString​(char delim,
                                              A array)
        Creates String representation of the array.
        Specified by:
        toArrayString in interface ArrayEncoding.ArrayEncoder<A>
        Parameters:
        delim - The character to use to delimit between elements.
        array - The array to represent as a String.
        Returns:
        String representation of the array.
      • appendArray

        abstract void appendArray​(java.lang.StringBuilder sb,
                                  char delim,
                                  A array)
        Append String representation of array to sb.
        Parameters:
        sb - The StringBuilder to append to.
        delim - The delimiter between elements.
        array - The array to represent. Will not be null, but may contain null elements.