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 ColumnType to 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.GEOMETRY is unsupported.- Author:
- Stanley Shyiko
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractRowsEventDataDeserializer(Map<Long, TableMapEventData> tableMapEventByTableId) -
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimalasBigDecimal(int precision, int scale, byte[] value) protected LongasUnixTime(int year, int month, int day, int hour, int minute, int second, int millis) protected SerializabledeserializeBit(int meta, ByteArrayInputStream inputStream) protected SerializabledeserializeBlob(int meta, ByteArrayInputStream inputStream) protected SerializabledeserializeCell(ColumnType type, int meta, int length, ByteArrayInputStream inputStream) protected SerializabledeserializeDate(ByteArrayInputStream inputStream) protected SerializabledeserializeDatetime(ByteArrayInputStream inputStream) protected SerializabledeserializeDatetimeV2(int meta, ByteArrayInputStream inputStream) protected SerializabledeserializeDouble(ByteArrayInputStream inputStream) protected SerializabledeserializeEnum(int length, ByteArrayInputStream inputStream) protected SerializabledeserializeFloat(ByteArrayInputStream inputStream) protected intdeserializeFractionalSeconds(int meta, ByteArrayInputStream inputStream) protected SerializabledeserializeGeometry(int meta, ByteArrayInputStream inputStream) protected SerializabledeserializeInt24(ByteArrayInputStream inputStream) protected byte[]deserializeJson(int meta, ByteArrayInputStream inputStream) Deserialize theJSONvalue on the input stream, and return MySQL's internal binary representation of the JSON value.protected SerializabledeserializeLong(ByteArrayInputStream inputStream) protected SerializabledeserializeLongLong(ByteArrayInputStream inputStream) protected SerializabledeserializeNewDecimal(int meta, ByteArrayInputStream inputStream) protected Serializable[]deserializeRow(long tableId, BitSet includedColumns, ByteArrayInputStream inputStream) protected SerializabledeserializeSet(int length, ByteArrayInputStream inputStream) protected SerializabledeserializeShort(ByteArrayInputStream inputStream) protected SerializabledeserializeString(int length, ByteArrayInputStream inputStream) protected SerializabledeserializeTime(ByteArrayInputStream inputStream) protected SerializabledeserializeTimestamp(ByteArrayInputStream inputStream) protected SerializabledeserializeTimestampV2(int meta, ByteArrayInputStream inputStream) protected SerializabledeserializeTimeV2(int meta, ByteArrayInputStream inputStream) protected SerializabledeserializeTiny(ByteArrayInputStream inputStream) protected SerializabledeserializeVarString(int meta, ByteArrayInputStream inputStream) protected SerializabledeserializeVector(int meta, ByteArrayInputStream inputStream) protected SerializabledeserializeYear(ByteArrayInputStream inputStream) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.shyiko.mysql.binlog.event.deserialization.EventDataDeserializer
deserialize
-
Constructor Details
-
AbstractRowsEventDataDeserializer
-
-
Method Details
-
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
- Throws:
IOException
-
deserializeShort
- Throws:
IOException
-
deserializeInt24
- Throws:
IOException
-
deserializeLong
- Throws:
IOException
-
deserializeLongLong
- Throws:
IOException
-
deserializeFloat
- Throws:
IOException
-
deserializeDouble
- Throws:
IOException
-
deserializeNewDecimal
protected Serializable deserializeNewDecimal(int meta, ByteArrayInputStream inputStream) throws IOException - Throws:
IOException
-
deserializeDate
- Throws:
IOException
-
deserializeTime
- Throws:
IOException
-
deserializeTimeV2
protected Serializable deserializeTimeV2(int meta, ByteArrayInputStream inputStream) throws IOException - Throws:
IOException
-
deserializeTimestamp
- Throws:
IOException
-
deserializeTimestampV2
protected Serializable deserializeTimestampV2(int meta, ByteArrayInputStream inputStream) throws IOException - Throws:
IOException
-
deserializeDatetime
- Throws:
IOException
-
deserializeDatetimeV2
protected Serializable deserializeDatetimeV2(int meta, ByteArrayInputStream inputStream) throws IOException - Throws:
IOException
-
deserializeYear
- 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
-
deserializeVector
protected Serializable deserializeVector(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
Deserialize 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
-