Package org.mariadb.jdbc.plugin.codec
Class FloatObjectArrayCodec
- java.lang.Object
-
- org.mariadb.jdbc.plugin.codec.FloatObjectArrayCodec
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static intBYTES_IN_FLOATprivate static java.util.EnumSet<DataType>COMPATIBLE_TYPESprivate static java.lang.ClassfloatArrayClassstatic FloatObjectArrayCodecINSTANCEdefault instance
-
Constructor Summary
Constructors Constructor Description FloatObjectArrayCodec()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanDecode(ColumnDecoder column, java.lang.Class<?> type)If codec can decode this a server datatype to a java class typebooleancanEncode(java.lang.Object value)Can Codec encode the java object typejava.lang.StringclassName()Codec native typejava.lang.Float[]decodeBinary(ReadableByteBuf buf, MutableInt length, ColumnDecoder column, java.util.Calendar cal, Context context)Decode from a mysql packet binary encoded a value to codec java typejava.lang.Float[]decodeText(ReadableByteBuf buf, MutableInt length, ColumnDecoder column, java.util.Calendar cal, Context context)Decode from a mysql packet text encoded a value to codec java typevoidencodeBinary(Writer encoder, Context context, java.lang.Object value, java.util.Calendar cal, java.lang.Long maxLength)Binary encode value to writervoidencodeText(Writer encoder, Context context, java.lang.Object value, java.util.Calendar cal, java.lang.Long maxLen)Text encode value to writerintgetBinaryEncodeType()Return server encoding data typeprivate byte[]getBytes(ReadableByteBuf buf, MutableInt length, ColumnDecoder column)static byte[]toByteArray(java.lang.Float[] floatArray)static java.lang.Float[]toFloatArray(byte[] byteArray)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mariadb.jdbc.plugin.Codec
canEncodeLongData, encodeData, encodeLongData
-
-
-
-
Field Detail
-
INSTANCE
public static final FloatObjectArrayCodec INSTANCE
default instance
-
floatArrayClass
private static java.lang.Class floatArrayClass
-
COMPATIBLE_TYPES
private static final java.util.EnumSet<DataType> COMPATIBLE_TYPES
-
BYTES_IN_FLOAT
static final int BYTES_IN_FLOAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
className
public java.lang.String className()
Description copied from interface:CodecCodec native type
-
canDecode
public boolean canDecode(ColumnDecoder column, java.lang.Class<?> type)
Description copied from interface:CodecIf codec can decode this a server datatype to a java class type
-
canEncode
public boolean canEncode(java.lang.Object value)
Description copied from interface:CodecCan Codec encode the java object type
-
decodeText
public java.lang.Float[] decodeText(ReadableByteBuf buf, MutableInt length, ColumnDecoder column, java.util.Calendar cal, Context context) throws java.sql.SQLDataException
Description copied from interface:CodecDecode from a mysql packet text encoded a value to codec java type- Specified by:
decodeTextin interfaceCodec<java.lang.Float[]>- Parameters:
buf- mysql packet bufferlength- encoded value lengthcolumn- server column metadatacal- calendarcontext- connection context- Returns:
- decoded value
- Throws:
java.sql.SQLDataException- if unexpected error occurs during decoding
-
decodeBinary
public java.lang.Float[] decodeBinary(ReadableByteBuf buf, MutableInt length, ColumnDecoder column, java.util.Calendar cal, Context context) throws java.sql.SQLDataException
Description copied from interface:CodecDecode from a mysql packet binary encoded a value to codec java type- Specified by:
decodeBinaryin interfaceCodec<java.lang.Float[]>- Parameters:
buf- mysql packet bufferlength- encoded value lengthcolumn- server column metadatacal- calendarcontext- connection context- Returns:
- decoded value
- Throws:
java.sql.SQLDataException- if unexpected error occurs during decoding
-
toByteArray
public static byte[] toByteArray(java.lang.Float[] floatArray)
-
toFloatArray
public static java.lang.Float[] toFloatArray(byte[] byteArray)
-
getBytes
private byte[] getBytes(ReadableByteBuf buf, MutableInt length, ColumnDecoder column) throws java.sql.SQLDataException
- Throws:
java.sql.SQLDataException
-
encodeText
public void encodeText(Writer encoder, Context context, java.lang.Object value, java.util.Calendar cal, java.lang.Long maxLen) throws java.io.IOException
Description copied from interface:CodecText encode value to writer- Specified by:
encodeTextin interfaceCodec<java.lang.Float[]>- Parameters:
encoder- writercontext- connection contextvalue- value to encodecal- calendarmaxLen- maximum value length- Throws:
java.io.IOException- if any socket error occurs
-
encodeBinary
public void encodeBinary(Writer encoder, Context context, java.lang.Object value, java.util.Calendar cal, java.lang.Long maxLength) throws java.io.IOException
Description copied from interface:CodecBinary encode value to writer- Specified by:
encodeBinaryin interfaceCodec<java.lang.Float[]>- Parameters:
encoder- writercontext- connection contextvalue- value to encodecal- calendarmaxLength- maximum value length- Throws:
java.io.IOException- if any socket error occurs
-
getBinaryEncodeType
public int getBinaryEncodeType()
Description copied from interface:CodecReturn server encoding data type- Specified by:
getBinaryEncodeTypein interfaceCodec<java.lang.Float[]>- Returns:
- server encoding data type
-
-