docs: public void writeTo(ByteBuffer out)
    {
      checkOpen();
      for (int i = 0; i <= headBufferIndex; i++) {
        ByteBuffer buffer = buffers.get(i);
        buffer.flip();
        out.put(buffer);
        // switch back to the initial state
        buffer.limit(buffer.capacity());
      }
    }