A
- The primitive array to support.private abstract static class ArrayEncoding.FixedSizePrimitiveArrayEncoder<A> extends ArrayEncoding.AbstractArrayEncoder<A>
Modifier and Type | Field and Description |
---|---|
private int |
fieldSize |
arrayOid
Constructor and Description |
---|
FixedSizePrimitiveArrayEncoder(int fieldSize,
int oid,
int arrayOid) |
Modifier and Type | Method and Description |
---|---|
(package private) int |
countNulls(A array)
Counts the number of
null elements in array. |
byte[] |
toBinaryRepresentation(BaseConnection connection,
A array,
int oid)
Creates binary representation of the array.
|
(package private) byte[] |
toSingleDimensionBinaryRepresentation(BaseConnection connection,
A array)
Creates
byte[] of just the raw data (no metadata). |
protected abstract void |
write(A array,
byte[] bytes,
int offset)
Write the entire contents of array to bytes starting at
offset without metadata describing type or length.
|
appendArray, getDefaultArrayTypeOid, getTypeOID, supportBinaryRepresentation, toArrayString
FixedSizePrimitiveArrayEncoder(int fieldSize, int oid, int arrayOid)
final int countNulls(A array)
null
elements in array.
Always returns 0
.
countNulls
in class ArrayEncoding.AbstractArrayEncoder<A>
array
- The array to count null
elements in.null
elements in array.public final byte[] toBinaryRepresentation(BaseConnection connection, A array, int oid) throws java.sql.SQLException, java.sql.SQLFeatureNotSupportedException
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
final byte[] toSingleDimensionBinaryRepresentation(BaseConnection connection, A array) throws java.sql.SQLException, java.sql.SQLFeatureNotSupportedException
byte[]
of just the raw data (no metadata).toSingleDimensionBinaryRepresentation
in class ArrayEncoding.AbstractArrayEncoder<A>
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.byte[]
of just the raw data (no metadata).java.sql.SQLFeatureNotSupportedException
- If ArrayEncoding.AbstractArrayEncoder.supportBinaryRepresentation(int)
is false for
oid.java.sql.SQLException
protected abstract void write(A array, byte[] bytes, int offset)
array
- The array to write.bytes
- The byte[]
to write to.offset
- The offset into bytes to start writing.