Package org.postgresql.jdbc
Class ArrayDecoding
- java.lang.Object
-
- org.postgresql.jdbc.ArrayDecoding
-
final class ArrayDecoding extends java.lang.Object
Utility for decoding arrays.See
ArrayEncoding
for description of the binary format of arrays.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ArrayDecoding.AbstractObjectArrayDecoder<A>
private static class
ArrayDecoding.AbstractObjectStringArrayDecoder<A>
private static class
ArrayDecoding.ArrayAssistantObjectArrayDecoder
private static interface
ArrayDecoding.ArrayDecoder<A>
private static class
ArrayDecoding.MappedTypeObjectArrayDecoder
(package private) static class
ArrayDecoding.PgArrayList
Array list implementation specific for storing PG array elements.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ArrayDecoding()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static ArrayDecoding.PgArrayList
buildArrayList(java.lang.String fieldString, char delim)
Parses the string representation of an array into aArrayDecoding.PgArrayList
.private static <A> ArrayDecoding.ArrayDecoder<A>
getDecoder(int oid, BaseConnection connection)
static java.lang.Object
readBinaryArray(int index, int count, byte[] bytes, BaseConnection connection)
Reads binary representation of array into object model.static java.lang.Object
readStringArray(int index, int count, int oid, ArrayDecoding.PgArrayList list, BaseConnection connection)
ReadsString
representation of array into object model.private static <A> void
storeStringValues(A[] array, ArrayDecoding.ArrayDecoder<A> decoder, java.util.List list, int[] dimensionLengths, int dim, BaseConnection connection)
private static <A> void
storeValues(A[] array, ArrayDecoding.ArrayDecoder<A> decoder, java.nio.ByteBuffer bytes, int skip, int[] dimensionLengths, int dim, BaseConnection connection)
-
-
-
Field Detail
-
LONG_OBJ_ARRAY
private static final ArrayDecoding.ArrayDecoder<java.lang.Long[]> LONG_OBJ_ARRAY
-
INT4_UNSIGNED_OBJ_ARRAY
private static final ArrayDecoding.ArrayDecoder<java.lang.Long[]> INT4_UNSIGNED_OBJ_ARRAY
-
INTEGER_OBJ_ARRAY
private static final ArrayDecoding.ArrayDecoder<java.lang.Integer[]> INTEGER_OBJ_ARRAY
-
SHORT_OBJ_ARRAY
private static final ArrayDecoding.ArrayDecoder<java.lang.Short[]> SHORT_OBJ_ARRAY
-
DOUBLE_OBJ_ARRAY
private static final ArrayDecoding.ArrayDecoder<java.lang.Double[]> DOUBLE_OBJ_ARRAY
-
FLOAT_OBJ_ARRAY
private static final ArrayDecoding.ArrayDecoder<java.lang.Float[]> FLOAT_OBJ_ARRAY
-
BOOLEAN_OBJ_ARRAY
private static final ArrayDecoding.ArrayDecoder<java.lang.Boolean[]> BOOLEAN_OBJ_ARRAY
-
STRING_ARRAY
private static final ArrayDecoding.ArrayDecoder<java.lang.String[]> STRING_ARRAY
-
BYTE_ARRAY_ARRAY
private static final ArrayDecoding.ArrayDecoder<byte[][]> BYTE_ARRAY_ARRAY
-
BIG_DECIMAL_STRING_DECODER
private static final ArrayDecoding.ArrayDecoder<java.math.BigDecimal[]> BIG_DECIMAL_STRING_DECODER
-
STRING_ONLY_DECODER
private static final ArrayDecoding.ArrayDecoder<java.lang.String[]> STRING_ONLY_DECODER
-
DATE_DECODER
private static final ArrayDecoding.ArrayDecoder<java.sql.Date[]> DATE_DECODER
-
TIME_DECODER
private static final ArrayDecoding.ArrayDecoder<java.sql.Time[]> TIME_DECODER
-
TIMESTAMP_DECODER
private static final ArrayDecoding.ArrayDecoder<java.sql.Timestamp[]> TIMESTAMP_DECODER
-
OID_TO_DECODER
private static final java.util.Map<java.lang.Integer,ArrayDecoding.ArrayDecoder> OID_TO_DECODER
Maps from base type oid toArrayDecoding.ArrayDecoder
capable of processing entries.
-
-
Method Detail
-
getDecoder
private static <A> ArrayDecoding.ArrayDecoder<A> getDecoder(int oid, BaseConnection connection) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
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 aArrayDecoding.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
ReadsString
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
-
-