T - java type supportedpublic interface Codec<T>
| Modifier and Type | Method and Description |
|---|---|
boolean |
canDecode(com.singlestore.jdbc.client.ColumnDecoder column,
Class<?> type)
If codec can decode this a server datatype to a java class type
|
boolean |
canEncode(Object value)
Can Codec encode the java object type
|
default boolean |
canEncodeLongData()
Indicate if can encode long data
|
String |
className()
Codec native type
|
T |
decodeBinary(com.singlestore.jdbc.client.ReadableByteBuf buffer,
MutableInt fieldLength,
com.singlestore.jdbc.client.ColumnDecoder column,
Calendar cal)
Decode from a mysql packet binary encoded a value to codec java type
|
T |
decodeText(com.singlestore.jdbc.client.ReadableByteBuf buffer,
MutableInt fieldLength,
com.singlestore.jdbc.client.ColumnDecoder column,
Calendar cal)
Decode from a mysql packet text encoded a value to codec java type
|
void |
encodeBinary(Writer encoder,
Object value,
Calendar cal,
Long length)
Binary encode value to writer
|
default void |
encodeBinaryAsString(Writer encoder,
Object value,
Long length) |
default byte[] |
encodeData(T value,
Long length)
binary encoding value to a byte[]
|
default void |
encodeLongData(Writer encoder,
T value,
Long length)
binary encoding value to a long data packet
|
void |
encodeText(Writer encoder,
com.singlestore.jdbc.client.Context context,
Object value,
Calendar cal,
Long length)
Text encode value to writer
|
int |
getApproximateTextProtocolLength(Object value)
Approximate length in bytes.
|
int |
getBinaryEncodeType()
Return server encoding data type
|
String className()
boolean canDecode(com.singlestore.jdbc.client.ColumnDecoder column,
Class<?> type)
column - server datatypetype - java return classboolean canEncode(Object value)
value - java object typeint getApproximateTextProtocolLength(Object value) throws SQLException
value - to calculateSQLExceptionT decodeText(com.singlestore.jdbc.client.ReadableByteBuf buffer, MutableInt fieldLength, com.singlestore.jdbc.client.ColumnDecoder column, Calendar cal) throws SQLDataException
buffer - mysql packet bufferfieldLength - encoded value lengthcolumn - server column metadatacal - calendarSQLDataException - if unexpected error occurs during decodingT decodeBinary(com.singlestore.jdbc.client.ReadableByteBuf buffer, MutableInt fieldLength, com.singlestore.jdbc.client.ColumnDecoder column, Calendar cal) throws SQLDataException
buffer - mysql packet bufferfieldLength - encoded value lengthcolumn - server column metadatacal - calendarSQLDataException - if unexpected error occurs during decodingvoid encodeText(Writer encoder, com.singlestore.jdbc.client.Context context, Object value, Calendar cal, Long length) throws IOException, SQLException
encoder - writercontext - connection contextvalue - value to encodecal - calendarlength - maximum value lengthIOException - if any socket error occursSQLException - if encoding error occursvoid encodeBinary(Writer encoder, Object value, Calendar cal, Long length) throws IOException, SQLException
encoder - writervalue - value to encodecal - calendarlength - maximum value lengthIOException - if any socket error occursSQLException - if encoding error occursdefault boolean canEncodeLongData()
default void encodeLongData(Writer encoder, T value, Long length) throws IOException, SQLException
encoder - writervalue - value to encodelength - maximum length valueIOException - if any socket error occursSQLException - if encoding error occursdefault byte[] encodeData(T value, Long length) throws IOException, SQLException
value - value to encodelength - maximum length valueIOException - if any socket error occursSQLException - if encoding error occursint getBinaryEncodeType()
default void encodeBinaryAsString(Writer encoder, Object value, Long length) throws IOException
IOExceptionCopyright © 2025 SingleStore. All rights reserved.