@Override @SuppressWarnings("unchecked") public ByteArray read(DataInput dataInput) { int length = dataInput.readInt(); // We can use ByteArray.wrap here since in this use case the dataInput // will always be a DataInputImpl which copies the bytes when reading // them. return ByteArray.wrap(dataInput.readBytes(length)); }