public class MysqlTextValueDecoder extends java.lang.Object implements ValueDecoder
ValueDecoder
for the MySQL text protocol. All values will be received as LengthEncodedString values.
Refer to MySQL documentation for format of values as strings.
Numeric values are returned as ASCII (encoding=63/binary).
Modifier and Type | Field and Description |
---|---|
static int |
DATE_BUF_LEN
Buffer length of MySQL date string: 'YYYY-MM-DD'.
|
static int |
MAX_SIGNED_LONG_LEN
Max string length of a signed long = 9223372036854775807 (19+1 for minus sign)
|
static int |
TIME_STR_LEN_MAX_NO_FRAC
Max string length of MySQL time string (with microseconds): '-HHH:MM:SS'.
|
static int |
TIME_STR_LEN_MAX_WITH_MICROS
Max string length of MySQL time string (with microseconds): '-HHH:MM:SS.mmmmmm'.
|
static int |
TIME_STR_LEN_MIN
Min string length of MySQL time string: 'HH:MM:SS'.
|
static int |
TIMESTAMP_STR_LEN_NO_FRAC
String length of MySQL timestamp string (no microseconds): 'YYYY-MM-DD HH:MM:SS'.
|
static int |
TIMESTAMP_STR_LEN_WITH_MICROS
Max string length of MySQL timestamp (with microsecs): 'YYYY-MM-DD HH:MM:SS.mmmmmm'.
|
static int |
TIMESTAMP_STR_LEN_WITH_NANOS
String length of String timestamp with nanos.
|
Constructor and Description |
---|
MysqlTextValueDecoder() |
Modifier and Type | Method and Description |
---|---|
<T> T |
decodeBit(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeByteArray(byte[] bytes,
int offset,
int length,
Field f,
ValueFactory<T> vf) |
<T> T |
decodeDate(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeDecimal(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeDouble(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeFloat(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeInt1(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeInt2(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeInt4(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeInt8(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeSet(byte[] bytes,
int offset,
int length,
Field f,
ValueFactory<T> vf) |
<T> T |
decodeTime(byte[] bytes,
int offset,
int length,
int scale,
ValueFactory<T> vf) |
<T> T |
decodeTimestamp(byte[] bytes,
int offset,
int length,
int scale,
ValueFactory<T> vf) |
<T> T |
decodeUInt1(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeUInt2(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeUInt4(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeUInt8(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
<T> T |
decodeYear(byte[] bytes,
int offset,
int length,
ValueFactory<T> vf) |
static java.math.BigInteger |
getBigInteger(byte[] buf,
int offset,
int length) |
static InternalDate |
getDate(byte[] bytes,
int offset,
int length) |
static java.lang.Double |
getDouble(byte[] bytes,
int offset,
int length) |
static int |
getInt(byte[] buf,
int offset,
int endpos) |
static long |
getLong(byte[] buf,
int offset,
int endpos) |
static InternalTime |
getTime(byte[] bytes,
int offset,
int length,
int scale) |
static InternalTimestamp |
getTimestamp(byte[] bytes,
int offset,
int length,
int scale) |
static boolean |
isDate(java.lang.String s) |
static boolean |
isTime(java.lang.String s) |
static boolean |
isTimestamp(java.lang.String s) |
public static final int DATE_BUF_LEN
public static final int TIME_STR_LEN_MIN
public static final int TIME_STR_LEN_MAX_NO_FRAC
public static final int TIME_STR_LEN_MAX_WITH_MICROS
public static final int TIMESTAMP_STR_LEN_NO_FRAC
public static final int TIMESTAMP_STR_LEN_WITH_MICROS
public static final int TIMESTAMP_STR_LEN_WITH_NANOS
public static final int MAX_SIGNED_LONG_LEN
public <T> T decodeDate(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeDate
in interface ValueDecoder
public <T> T decodeTime(byte[] bytes, int offset, int length, int scale, ValueFactory<T> vf)
decodeTime
in interface ValueDecoder
public <T> T decodeTimestamp(byte[] bytes, int offset, int length, int scale, ValueFactory<T> vf)
decodeTimestamp
in interface ValueDecoder
public <T> T decodeUInt1(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeUInt1
in interface ValueDecoder
public <T> T decodeInt1(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeInt1
in interface ValueDecoder
public <T> T decodeUInt2(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeUInt2
in interface ValueDecoder
public <T> T decodeInt2(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeInt2
in interface ValueDecoder
public <T> T decodeUInt4(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeUInt4
in interface ValueDecoder
public <T> T decodeInt4(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeInt4
in interface ValueDecoder
public <T> T decodeUInt8(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeUInt8
in interface ValueDecoder
public <T> T decodeInt8(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeInt8
in interface ValueDecoder
public <T> T decodeFloat(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeFloat
in interface ValueDecoder
public <T> T decodeDouble(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeDouble
in interface ValueDecoder
public <T> T decodeDecimal(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeDecimal
in interface ValueDecoder
public <T> T decodeByteArray(byte[] bytes, int offset, int length, Field f, ValueFactory<T> vf)
decodeByteArray
in interface ValueDecoder
public <T> T decodeBit(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeBit
in interface ValueDecoder
public <T> T decodeSet(byte[] bytes, int offset, int length, Field f, ValueFactory<T> vf)
decodeSet
in interface ValueDecoder
public <T> T decodeYear(byte[] bytes, int offset, int length, ValueFactory<T> vf)
decodeYear
in interface ValueDecoder
public static int getInt(byte[] buf, int offset, int endpos) throws java.lang.NumberFormatException
java.lang.NumberFormatException
public static long getLong(byte[] buf, int offset, int endpos) throws java.lang.NumberFormatException
java.lang.NumberFormatException
public static java.math.BigInteger getBigInteger(byte[] buf, int offset, int length) throws java.lang.NumberFormatException
java.lang.NumberFormatException
public static java.lang.Double getDouble(byte[] bytes, int offset, int length)
public static boolean isDate(java.lang.String s)
public static boolean isTime(java.lang.String s)
public static boolean isTimestamp(java.lang.String s)
public static InternalDate getDate(byte[] bytes, int offset, int length)
public static InternalTime getTime(byte[] bytes, int offset, int length, int scale)
public static InternalTimestamp getTimestamp(byte[] bytes, int offset, int length, int scale)