docs: @Override
    public void serialize(DataOutput out) throws IOException {
      if (buffer.hasArray()) {
        out.write(buffer.array(), buffer.arrayOffset(), buffer.limit());
      } else {
        ByteBuffer tmp = buffer.duplicate();
        tmp.position(0);
        try (WritableByteChannel channel = Channels.newChannel((OutputStream) out)) {
          channel.write(tmp);
        }
      }
    }