DataExternalizer<ByteArraySequence> () { return new DataExternalizer<>() { @Override public void save(@NotNull DataOutput out, ByteArraySequence value) throws IOException { int length = value.length(); DataInputOutputUtil.writeINT(out, length); out.write(value.getInternalBuffer(), value.getOffset(), length); } @Override public ByteArraySequence read(@NotNull DataInput in) throws IOException { int length = DataInputOutputUtil.readINT(in); byte[] buf = new byte[length]; in.readFully(buf); return ByteArraySequence.create(buf); } }; }