private int[] readMetadata(ByteArrayInputStream inputStream, byte[] columnTypes) throws IOException { int[] metadata = new int[columnTypes.length]; for (int i = 0; i < columnTypes.length; i++) { switch (ColumnType.byCode(columnTypes[i] & 0xFF)) { case FLOAT: case DOUBLE: case BLOB: case JSON: case GEOMETRY: metadata[i] = inputStream.readInteger(1); break; case BIT: case VARCHAR: case NEWDECIMAL: metadata[i] = inputStream.readInteger(2); break; case SET: case ENUM: case STRING: metadata[i] = bigEndianInteger(inputStream.read(2), 0, 2); break; case TIME_V2: case DATETIME_V2: case TIMESTAMP_V2: metadata[i] = inputStream.readInteger(1); // fsp (@see {@link ColumnType}) break; default: metadata[i] = 0; } } return metadata; }
@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; }