private static final class ArrayEncoding.RecursiveArrayEncoder extends java.lang.Object implements ArrayEncoding.ArrayEncoder
ArrayEncoding.AbstractArrayEncoder
implementation and provides support for
2 or more dimensions using recursion.Modifier and Type | Field and Description |
---|---|
private int |
dimensions |
private ArrayEncoding.AbstractArrayEncoder |
support |
Constructor and Description |
---|
RecursiveArrayEncoder(ArrayEncoding.AbstractArrayEncoder support,
int dimensions) |
Modifier and Type | Method and Description |
---|---|
private void |
arrayString(java.lang.StringBuilder sb,
java.lang.Object array,
char delim,
int depth) |
int |
getDefaultArrayTypeOid()
The default array type oid supported by this instance.
|
private boolean |
hasNulls(java.lang.Object array,
int depth) |
boolean |
supportBinaryRepresentation(int oid)
Indicates if an array can be encoded in binary form to array oid.
|
java.lang.String |
toArrayString(char delim,
java.lang.Object array)
Creates
String representation of the array. |
byte[] |
toBinaryRepresentation(BaseConnection connection,
java.lang.Object array,
int oid)
Creates binary representation of the array.
|
private void |
writeArray(BaseConnection connection,
byte[] buffer,
java.io.ByteArrayOutputStream baos,
java.lang.Object array,
int depth,
boolean first) |
private final ArrayEncoding.AbstractArrayEncoder support
private final int dimensions
RecursiveArrayEncoder(ArrayEncoding.AbstractArrayEncoder support, int dimensions)
support
- The instance providing support for the base array type.public int getDefaultArrayTypeOid()
getDefaultArrayTypeOid
in interface ArrayEncoding.ArrayEncoder
public java.lang.String toArrayString(char delim, java.lang.Object array)
String
representation of the array.toArrayString
in interface ArrayEncoding.ArrayEncoder
delim
- The character to use to delimit between elements.array
- The array to represent as a String
.String
representation of the array.private void arrayString(java.lang.StringBuilder sb, java.lang.Object array, char delim, int depth)
public boolean supportBinaryRepresentation(int oid)
supportBinaryRepresentation
in interface ArrayEncoding.ArrayEncoder
oid
- The array oid to see check for binary support.ArrayEncoding.ArrayEncoder.toBinaryRepresentation(BaseConnection, Object, int)
is
supported for oid.private boolean hasNulls(java.lang.Object array, int depth)
public byte[] toBinaryRepresentation(BaseConnection connection, java.lang.Object array, int oid) throws java.sql.SQLException, java.sql.SQLFeatureNotSupportedException
toBinaryRepresentation
in interface ArrayEncoding.ArrayEncoder
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
.java.sql.SQLFeatureNotSupportedException
- If ArrayEncoding.ArrayEncoder.supportBinaryRepresentation(int)
is false for
oid.java.sql.SQLException
private void writeArray(BaseConnection connection, byte[] buffer, java.io.ByteArrayOutputStream baos, java.lang.Object array, int depth, boolean first) throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException