Top Description Inners Fields Constructors Methods
org.postgresql.jdbc

pack-priv final Class ArrayDecoding

extends Object
Class Inheritance
Static Imports
org.postgresql.util.internal.Nullness.castNonNull

Utility for decoding arrays.

See ArrayEncoding for description of the binary format of arrays.

Author
Brett Okken

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
private abstract static class
private static class
private static interface
private static class
pack-priv static class
ArrayDecoding.PgArrayList

Array list implementation specific for storing PG array elements.

Field Summary

Modifier and TypeField and Description
private static final ArrayDecoding.ArrayDecoder<BigDecimal[]>
private static final ArrayDecoding.ArrayDecoder<Boolean[]>
private static final ArrayDecoding.ArrayDecoder<byte[][]>
private static final ArrayDecoding.ArrayDecoder<Date[]>
private static final ArrayDecoding.ArrayDecoder<Double[]>
private static final ArrayDecoding.ArrayDecoder<Float[]>
private static final ArrayDecoding.ArrayDecoder<Long[]>
private static final ArrayDecoding.ArrayDecoder<Integer[]>
private static final ArrayDecoding.ArrayDecoder<Long[]>
private static final Map<Integer, ArrayDecoding.ArrayDecoder<A extends @NonNull Object>>
OID_TO_DECODER

Maps from base type oid to ArrayDecoder capable of processing entries.

private static final ArrayDecoding.ArrayDecoder<Short[]>
private static final ArrayDecoding.ArrayDecoder<String[]>
private static final ArrayDecoding.ArrayDecoder<String[]>
private static final ArrayDecoding.ArrayDecoder<Time[]>
private static final ArrayDecoding.ArrayDecoder<Timestamp[]>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static ArrayDecoding.PgArrayList

Returns:

A PgArrayList representing the parsed fieldString.
buildArrayList
(String
The array value to parse.
fieldString
,
char
The delimiter character appropriate for the data type.
delim
)

Parses the string representation of an array into a PgArrayList.

private static <A extends @NonNull Object> ArrayDecoding.ArrayDecoder<A>
getDecoder(int oid, BaseConnection connection)

public static Object

Returns:

The parsed array.
readBinaryArray
(int
1 based index of where to start on outermost array.
index
,
int
The number of items to return from outermost array (beginning at index).
count
,
byte[]
The binary representation of the array.
bytes
,
BaseConnection
The connection the bytes were retrieved from.
connection
)

Reads binary representation of array into object model.

public static Object

Returns:

The parsed array.
readStringArray
(int
1 based index of where to start on outermost array.
index
,
int
The number of items to return from outermost array (beginning at index).
count
,
int
The oid of the base type of the array.
oid
,
ArrayDecoding.PgArrayList
The #buildArrayList(String, char) processed string representation of an array.
list
,
BaseConnection
The connection the bytes were retrieved from.
connection
)

Reads String representation of array into object model.

private static <A extends @NonNull Object> void
storeStringValues(A[] array, ArrayDecoding.ArrayDecoder<A> decoder, List<E> list, int[] dimensionLengths, int dim, BaseConnection connection)

private static <A extends @NonNull Object> void
storeValues(A[] array, ArrayDecoding.ArrayDecoder<A> decoder, ByteBuffer bytes, int skip, int[] dimensionLengths, int dim, BaseConnection connection)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BIG_DECIMAL_STRING_DECODERback to summary
private static final ArrayDecoding.ArrayDecoder<BigDecimal[]> BIG_DECIMAL_STRING_DECODER
BOOLEAN_OBJ_ARRAYback to summary
private static final ArrayDecoding.ArrayDecoder<Boolean[]> BOOLEAN_OBJ_ARRAY
BYTE_ARRAY_ARRAYback to summary
private static final ArrayDecoding.ArrayDecoder<byte[][]> BYTE_ARRAY_ARRAY
DATE_DECODERback to summary
private static final ArrayDecoding.ArrayDecoder<Date[]> DATE_DECODER
DOUBLE_OBJ_ARRAYback to summary
private static final ArrayDecoding.ArrayDecoder<Double[]> DOUBLE_OBJ_ARRAY
FLOAT_OBJ_ARRAYback to summary
private static final ArrayDecoding.ArrayDecoder<Float[]> FLOAT_OBJ_ARRAY
INT4_UNSIGNED_OBJ_ARRAYback to summary
private static final ArrayDecoding.ArrayDecoder<Long[]> INT4_UNSIGNED_OBJ_ARRAY
INTEGER_OBJ_ARRAYback to summary
private static final ArrayDecoding.ArrayDecoder<Integer[]> INTEGER_OBJ_ARRAY
LONG_OBJ_ARRAYback to summary
private static final ArrayDecoding.ArrayDecoder<Long[]> LONG_OBJ_ARRAY
OID_TO_DECODERback to summary
private static final Map<Integer, ArrayDecoding.ArrayDecoder<A extends @NonNull Object>> OID_TO_DECODER

Maps from base type oid to ArrayDecoder capable of processing entries.

Annotations
@SuppressWarnings:rawtypes
SHORT_OBJ_ARRAYback to summary
private static final ArrayDecoding.ArrayDecoder<Short[]> SHORT_OBJ_ARRAY
STRING_ARRAYback to summary
private static final ArrayDecoding.ArrayDecoder<String[]> STRING_ARRAY
STRING_ONLY_DECODERback to summary
private static final ArrayDecoding.ArrayDecoder<String[]> STRING_ONLY_DECODER
TIME_DECODERback to summary
private static final ArrayDecoding.ArrayDecoder<Time[]> TIME_DECODER
TIMESTAMP_DECODERback to summary
private static final ArrayDecoding.ArrayDecoder<Timestamp[]> TIMESTAMP_DECODER

Constructor Detail

ArrayDecodingback to summary
pack-priv ArrayDecoding()

Method Detail

buildArrayListback to summary
pack-priv static ArrayDecoding.PgArrayList buildArrayList(String fieldString, char delim)

Parses the string representation of an array into a PgArrayList.

Parameters
fieldString:String

The array value to parse.

delim:char

The delimiter character appropriate for the data type.

Returns:ArrayDecoding.PgArrayList

A PgArrayList representing the parsed fieldString.

getDecoderback to summary
private static <A extends @NonNull Object> ArrayDecoding.ArrayDecoder<A> getDecoder(int oid, BaseConnection connection) throws SQLException
Annotations
@SuppressWarnings:unchecked
readBinaryArrayback to summary
public static Object readBinaryArray(int index, int count, byte[] bytes, BaseConnection connection) throws SQLException

Reads binary representation of array into object model.

Parameters
index:int

1 based index of where to start on outermost array.

count:int

The number of items to return from outermost array (beginning at index).

bytes:byte[]

The binary representation of the array.

connection:BaseConnection

The connection the bytes were retrieved from.

Returns:Object

The parsed array.

Annotations
@SuppressWarnings:unchecked
Exceptions
SQLException:
For failures encountered during parsing.
readStringArrayback to summary
public static Object readStringArray(int index, int count, int oid, ArrayDecoding.PgArrayList list, BaseConnection connection) throws SQLException

Reads String representation of array into object model.

Parameters
index:int

1 based index of where to start on outermost array.

count:int

The number of items to return from outermost array (beginning at index).

oid:int

The oid of the base type of the array.

list:ArrayDecoding.PgArrayList

The #buildArrayList(String, char) processed string representation of an array.

connection:BaseConnection

The connection the bytes were retrieved from.

Returns:Object

The parsed array.

Annotations
@SuppressWarnings:unchecked, rawtypes
Exceptions
SQLException:
For failures encountered during parsing.
storeStringValuesback to summary
private static <A extends @NonNull Object> void storeStringValues(A[] array, ArrayDecoding.ArrayDecoder<A> decoder, List<E> list, int[] dimensionLengths, int dim, BaseConnection connection) throws SQLException
Annotations
@SuppressWarnings:unchecked, rawtypes
storeValuesback to summary
private static <A extends @NonNull Object> void storeValues(A[] array, ArrayDecoding.ArrayDecoder<A> decoder, ByteBuffer bytes, int skip, int[] dimensionLengths, int dim, BaseConnection connection) throws SQLException
Annotations
@SuppressWarnings:unchecked
org.postgresql.jdbc back to summary

private abstract Class ArrayDecoding.AbstractObjectArrayDecoder<A extends @NonNull Object>

extends ArrayDecoding.AbstractObjectStringArrayDecoder<A extends @NonNull Object>
Class Inheritance
Known Direct Subclasses
org.postgresql.jdbc.ArrayDecoding.ArrayAssistantObjectArrayDecoder, org.postgresql.jdbc.ArrayDecoding.MappedTypeObjectArrayDecoder

Field Summary

Inherited from org.postgresql.jdbc.ArrayDecoding.AbstractObjectStringArrayDecoder:
baseClazz

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract Object
parseValue(int length, ByteBuffer bytes, BaseConnection connection)

public void
public boolean
Inherited from org.postgresql.jdbc.ArrayDecoding.AbstractObjectStringArrayDecoder:
createArraycreateMultiDimensionalArrayparseValuepopulateFromString

Constructor Detail

AbstractObjectArrayDecoderback to summary
pack-priv AbstractObjectArrayDecoder(Class<?> baseClazz)

Method Detail

parseValueback to summary
pack-priv abstract Object parseValue(int length, ByteBuffer bytes, BaseConnection connection) throws SQLException
populateFromBinaryback to summary
public void populateFromBinary(A arr, @NonNegative int index, @NonNegative int count, ByteBuffer bytes, BaseConnection connection) throws SQLException

Overrides org.postgresql.jdbc.ArrayDecoding.AbstractObjectStringArrayDecoder.populateFromBinary.

Annotations
@Override
supportBinaryback to summary
public boolean supportBinary()

Overrides org.postgresql.jdbc.ArrayDecoding.AbstractObjectStringArrayDecoder.supportBinary.

Implements org.postgresql.jdbc.ArrayDecoding.ArrayDecoder.supportBinary.

Annotations
@Override
org.postgresql.jdbc back to summary

private abstract Class ArrayDecoding.AbstractObjectStringArrayDecoder<A extends @NonNull Object>

extends Object
implements ArrayDecoding.ArrayDecoder<A extends @NonNull Object>
Class Inheritance
  • java.lang.Object
  • org.postgresql.jdbc.ArrayDecoding.AbstractObjectStringArrayDecoder
All Implemented Interfaces
org.postgresql.jdbc.ArrayDecoding.ArrayDecoder
Known Direct Subclasses
org.postgresql.jdbc.ArrayDecoding.AbstractObjectArrayDecoder

Field Summary

Modifier and TypeField and Description
pack-priv final Class<?>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public A
createArray(int size)

public Object[]
pack-priv abstract Object
parseValue(String stringVal, BaseConnection connection)

public void
populateFromBinary(A arr, int index, int count, ByteBuffer bytes, BaseConnection connection)

public void
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseClazzback to summary
pack-priv final Class<?> baseClazz

Constructor Detail

AbstractObjectStringArrayDecoderback to summary
pack-priv AbstractObjectStringArrayDecoder(Class<?> baseClazz)

Method Detail

createArrayback to summary
public A createArray(int size)
Annotations
@SuppressWarnings:unchecked
@Override
createMultiDimensionalArrayback to summary
public Object[] createMultiDimensionalArray(int[] sizes)
Annotations
@Override
parseValueback to summary
pack-priv abstract Object parseValue(String stringVal, BaseConnection connection) throws SQLException
populateFromBinaryback to summary
public void populateFromBinary(A arr, int index, int count, ByteBuffer bytes, BaseConnection connection) throws SQLException
Annotations
@Override
populateFromStringback to summary
public void populateFromString(A arr, List<@Nullable String> strings, BaseConnection connection) throws SQLException

Implements org.postgresql.jdbc.ArrayDecoding.ArrayDecoder.populateFromString.

Annotations
@Override
supportBinaryback to summary
public boolean supportBinary()

Implements org.postgresql.jdbc.ArrayDecoding.ArrayDecoder.supportBinary.

Annotations
@Override
org.postgresql.jdbc back to summary

private final Class ArrayDecoding.ArrayAssistantObjectArrayDecoder

extends AbstractObjectArrayDecoder
Class Inheritance
Annotations
@SuppressWarnings:rawtypes

Field Summary

Modifier and TypeField and Description
private final ArrayAssistant

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
pack-priv Object
Inherited from org.postgresql.jdbc.ArrayDecoding.AbstractObjectArrayDecoder:
populateFromBinarysupportBinary

Field Detail

arrayAssistantback to summary
private final ArrayAssistant arrayAssistant

Constructor Detail

ArrayAssistantObjectArrayDecoderback to summary
pack-priv ArrayAssistantObjectArrayDecoder(ArrayAssistant arrayAssistant)
Annotations
@SuppressWarnings:unchecked

Method Detail

parseValueback to summary
pack-priv Object parseValue(int length, ByteBuffer bytes, BaseConnection connection) throws SQLException

Implements abstract org.postgresql.jdbc.ArrayDecoding.AbstractObjectArrayDecoder.parseValue.

Annotations
@Override
parseValueback to summary
pack-priv Object parseValue(String stringVal, BaseConnection connection) throws SQLException

Implements abstract org.postgresql.jdbc.ArrayDecoding.AbstractObjectStringArrayDecoder.parseValue.

Annotations
@Override
org.postgresql.jdbc back to summary

private Interface ArrayDecoding.ArrayDecoder<A extends @NonNull Object>

Known Direct Implementers
org.postgresql.jdbc.ArrayDecoding.AbstractObjectStringArrayDecoder

Method Summary

Modifier and TypeMethod and Description
public A
public Object[]
public void
populateFromBinary(A array, @NonNegative int index, @NonNegative int count, ByteBuffer bytes, BaseConnection connection)

public void
populateFromString(A array, List<@Nullable String> strings, BaseConnection connection)

public boolean

Method Detail

createArrayback to summary
public A createArray(@NonNegative int size)
createMultiDimensionalArrayback to summary
public Object[] createMultiDimensionalArray(@NonNegative int[] sizes)
populateFromBinaryback to summary
public void populateFromBinary(A array, @NonNegative int index, @NonNegative int count, ByteBuffer bytes, BaseConnection connection) throws SQLException
populateFromStringback to summary
public void populateFromString(A array, List<@Nullable String> strings, BaseConnection connection) throws SQLException
supportBinaryback to summary
public boolean supportBinary()
org.postgresql.jdbc back to summary

private final Class ArrayDecoding.MappedTypeObjectArrayDecoder

extends ArrayDecoding.AbstractObjectArrayDecoder<Object[]>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
pack-priv Object
Inherited from org.postgresql.jdbc.ArrayDecoding.AbstractObjectArrayDecoder:
populateFromBinarysupportBinary

Field Detail

typeNameback to summary
private final String typeName

Constructor Detail

MappedTypeObjectArrayDecoderback to summary
pack-priv MappedTypeObjectArrayDecoder(String baseTypeName)

Method Detail

parseValueback to summary
pack-priv Object parseValue(int length, ByteBuffer bytes, BaseConnection connection) throws SQLException

Implements abstract org.postgresql.jdbc.ArrayDecoding.AbstractObjectArrayDecoder.parseValue.

Annotations
@Override
parseValueback to summary
pack-priv Object parseValue(String stringVal, BaseConnection connection) throws SQLException

Implements abstract org.postgresql.jdbc.ArrayDecoding.AbstractObjectStringArrayDecoder.parseValue.

Annotations
@Override
org.postgresql.jdbc back to summary

pack-priv final Class ArrayDecoding.PgArrayList

extends ArrayList<@Nullable Object>
Class Inheritance

Array list implementation specific for storing PG array elements. If PgArrayList#dimensionsCount is 1, the contents will be String. For all larger dimensionsCount, the values will be PgArrayList instances.

Field Summary

Modifier and TypeField and Description
pack-priv int
dimensionsCount

How many dimensions.

private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.util.ArrayList:
addaddaddAlladdAlladdFirstaddLastclearclonecontainsensureCapacityequalsforEachgetgetFirstgetLasthashCodeindexOfisEmptyiteratorlastIndexOflistIteratorlistIteratorremoveremoveremoveAllremoveFirstremoveIfremoveLastremoveRangereplaceAllretainAllsetsizesortspliteratorsubListtoArraytoArraytrimToSize

Field Detail

dimensionsCountback to summary
pack-priv int dimensionsCount

How many dimensions.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.ArrayList.serialVersionUID.

Constructor Detail

PgArrayListback to summary
pack-priv PgArrayList()