Class AbstractRowsEventDataDeserializer<T extends EventData>
- java.lang.Object
-
- com.github.shyiko.mysql.binlog.event.deserialization.AbstractRowsEventDataDeserializer<T>
-
- Type Parameters:
T- event data this deserializer is responsible for
- All Implemented Interfaces:
EventDataDeserializer<T>
- Direct Known Subclasses:
DeleteRowsEventDataDeserializer,UpdateRowsEventDataDeserializer,WriteRowsEventDataDeserializer
public abstract class AbstractRowsEventDataDeserializer<T extends EventData> extends Object implements EventDataDeserializer<T>
Whole class is basically a mix of open-replicator's AbstractRowEventParser and MySQLUtils. Main purpose here is to ease rows deserialization.Current
ColumnTypeto java type mapping is following:
At the momentColumnType.TINY: IntegerColumnType.SHORT: IntegerColumnType.LONG: IntegerColumnType.INT24: IntegerColumnType.YEAR: IntegerColumnType.ENUM: IntegerColumnType.SET: LongColumnType.LONGLONG: LongColumnType.FLOAT: FloatColumnType.DOUBLE: DoubleColumnType.BIT: java.util.BitSetColumnType.DATETIME: java.util.DateColumnType.DATETIME_V2: java.util.DateColumnType.NEWDECIMAL: java.math.BigDecimalColumnType.TIMESTAMP: java.sql.TimestampColumnType.TIMESTAMP_V2: java.sql.TimestampColumnType.DATE: java.sql.DateColumnType.TIME: java.sql.TimeColumnType.TIME_V2: java.sql.TimeColumnType.VARCHAR: StringColumnType.VAR_STRING: StringColumnType.STRING: StringColumnType.BLOB: byte[]ColumnType.GEOMETRY: byte[]ColumnType.GEOMETRYis unsupported.- Author:
- Stanley Shyiko
-
-
Constructor Summary
Constructors Constructor Description AbstractRowsEventDataDeserializer(Map<Long,TableMapEventData> tableMapEventByTableId)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.shyiko.mysql.binlog.event.deserialization.EventDataDeserializer
deserialize
-
-
-
-
Constructor Detail
-
AbstractRowsEventDataDeserializer
public AbstractRowsEventDataDeserializer(Map<Long,TableMapEventData> tableMapEventByTableId)
-
-
Method Detail
-
deserializeRow
protected Serializable[] deserializeRow(long tableId, BitSet includedColumns, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeCell
protected Serializable deserializeCell(ColumnType type, int meta, int length, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeBit
protected Serializable deserializeBit(int meta, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeTiny
protected Serializable deserializeTiny(ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeShort
protected Serializable deserializeShort(ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeInt24
protected Serializable deserializeInt24(ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeLong
protected Serializable deserializeLong(ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeLongLong
protected Serializable deserializeLongLong(ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeFloat
protected Serializable deserializeFloat(ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeDouble
protected Serializable deserializeDouble(ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeNewDecimal
protected Serializable deserializeNewDecimal(int meta, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeDate
protected Serializable deserializeDate(ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeTime
protected Serializable deserializeTime(ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeTimeV2
protected Serializable deserializeTimeV2(int meta, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeTimestamp
protected Serializable deserializeTimestamp(ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeTimestampV2
protected Serializable deserializeTimestampV2(int meta, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeDatetime
protected Serializable deserializeDatetime(ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeDatetimeV2
protected Serializable deserializeDatetimeV2(int meta, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeYear
protected Serializable deserializeYear(ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeString
protected Serializable deserializeString(int length, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeVarString
protected Serializable deserializeVarString(int meta, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeBlob
protected Serializable deserializeBlob(int meta, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeEnum
protected Serializable deserializeEnum(int length, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeSet
protected Serializable deserializeSet(int length, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeGeometry
protected Serializable deserializeGeometry(int meta, ByteArrayInputStream inputStream) throws IOException
- Throws:
IOException
-
deserializeJson
protected byte[] deserializeJson(int meta, ByteArrayInputStream inputStream) throws IOExceptionDeserialize theJSONvalue on the input stream, and return MySQL's internal binary representation of the JSON value. SeeJsonBinaryfor a utility to parse this binary representation into something more useful, including a string representation.- Parameters:
meta- the number of bytes in which the length of the JSON value is found first on the input streaminputStream- the stream containing the JSON value- Returns:
- the MySQL internal binary representation of the JSON value; may be null
- Throws:
IOException- if there is a problem reading the input stream
-
asUnixTime
protected Long asUnixTime(int year, int month, int day, int hour, int minute, int second, int millis)
-
deserializeFractionalSeconds
protected int deserializeFractionalSeconds(int meta, ByteArrayInputStream inputStream) throws IOException- Throws:
IOException
-
asBigDecimal
public static BigDecimal asBigDecimal(int precision, int scale, byte[] value)
-
-