@Override public void write(DataOutput output) throws IOException { WritableUtils.writeVInt(output, returnCode.ordinal()); output.writeLong(mutationTime); output.writeBoolean(table != null); if (table != null) { table.write(output); } Bytes.writeByteArray(output, columnName == null ? ByteUtil.EMPTY_BYTE_ARRAY : columnName); if (columnName != null) { Bytes.writeByteArray(output, familyName == null ? ByteUtil.EMPTY_BYTE_ARRAY : familyName); } if (tableNamesToDelete != null && tableNamesToDelete.size() > 0) { output.writeBoolean(true); output.writeInt(tableNamesToDelete.size()); for (byte[] tableName : tableNamesToDelete) { Bytes.writeByteArray(output, tableName); } } else { output.writeBoolean(false); } }
@Override public void readFields(DataInput input) throws IOException { this.returnCode = MutationCode.values()[WritableUtils.readVInt(input)]; this.mutationTime = input.readLong(); boolean hasTable = input.readBoolean(); if (hasTable) { this.table = new PTableImpl(); this.table.readFields(input); } columnName = Bytes.readByteArray(input); if (columnName.length > 0) { familyName = Bytes.readByteArray(input); } boolean hasTablesToDelete = input.readBoolean(); if (hasTablesToDelete) { int count = input.readInt(); tableNamesToDelete = Lists.newArrayListWithExpectedSize(count); for (int i = 0; i < count; i++) { byte[] tableName = Bytes.readByteArray(input); tableNamesToDelete.add(tableName); } } }