@Override public TableMapEventData deserialize(ByteArrayInputStream inputStream) throws IOException { TableMapEventData eventData = new TableMapEventData(); eventData.setTableId(inputStream.readLong(6)); inputStream.skip(3); // 2 bytes reserved for future use + 1 for the length of database name eventData.setDatabase(inputStream.readZeroTerminatedString()); inputStream.skip(1); // table name eventData.setTable(inputStream.readZeroTerminatedString()); int numberOfColumns = inputStream.readPackedInteger(); eventData.setColumnTypes(inputStream.read(numberOfColumns)); inputStream.readPackedInteger(); // metadata length eventData.setColumnMetadata(readMetadata(inputStream, eventData.getColumnTypes())); eventData.setColumnNullability(inputStream.readBitSet(numberOfColumns, true)); return eventData; }
@Override public DeleteRowsEventData deserialize(ByteArrayInputStream inputStream) throws IOException { DeleteRowsEventData eventData = new DeleteRowsEventData(); eventData.setTableId(inputStream.readLong(6)); inputStream.readInteger(2); // reserved if (mayContainExtraInformation) { int extraInfoLength = inputStream.readInteger(2); inputStream.skip(extraInfoLength - 2); } int numberOfColumns = inputStream.readPackedInteger(); eventData.setIncludedColumns(inputStream.readBitSet(numberOfColumns, true)); eventData.setRows( deserializeRows(eventData.getTableId(), eventData.getIncludedColumns(), inputStream)); return eventData; }