Class ArrayDecoding


  • final class ArrayDecoding
    extends java.lang.Object
    Utility for decoding arrays.

    See ArrayEncoding for description of the binary format of arrays.

    • Constructor Detail

      • ArrayDecoding

        ArrayDecoding()
    • Method Detail

      • readBinaryArray

        public static java.lang.Object readBinaryArray​(int index,
                                                       int count,
                                                       byte[] bytes,
                                                       BaseConnection connection)
                                                throws java.sql.SQLException
        Reads binary representation of array into object model.
        Parameters:
        index - 1 based index of where to start on outermost array.
        count - The number of items to return from outermost array (beginning at index).
        bytes - The binary representation of the array.
        connection - The connection the bytes were retrieved from.
        Returns:
        The parsed array.
        Throws:
        java.sql.SQLException - For failures encountered during parsing.
      • storeValues

        private static <A> void storeValues​(A[] array,
                                            ArrayDecoding.ArrayDecoder<A> decoder,
                                            java.nio.ByteBuffer bytes,
                                            int skip,
                                            int[] dimensionLengths,
                                            int dim,
                                            BaseConnection connection)
                                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • buildArrayList

        static ArrayDecoding.PgArrayList buildArrayList​(java.lang.String fieldString,
                                                        char delim)
        Parses the string representation of an array into a ArrayDecoding.PgArrayList.
        Parameters:
        fieldString - The array value to parse.
        delim - The delimiter character appropriate for the data type.
        Returns:
        A ArrayDecoding.PgArrayList representing the parsed fieldString.
      • readStringArray

        public static java.lang.Object readStringArray​(int index,
                                                       int count,
                                                       int oid,
                                                       ArrayDecoding.PgArrayList list,
                                                       BaseConnection connection)
                                                throws java.sql.SQLException
        Reads String representation of array into object model.
        Parameters:
        index - 1 based index of where to start on outermost array.
        count - The number of items to return from outermost array (beginning at index).
        oid - The oid of the base type of the array.
        list - The #buildArrayList(String, char) processed string representation of an array.
        connection - The connection the bytes were retrieved from.
        Returns:
        The parsed array.
        Throws:
        java.sql.SQLException - For failures encountered during parsing.
      • storeStringValues

        private static <A> void storeStringValues​(A[] array,
                                                  ArrayDecoding.ArrayDecoder<A> decoder,
                                                  java.util.List list,
                                                  int[] dimensionLengths,
                                                  int dim,
                                                  BaseConnection connection)
                                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException