docs: private void flushBuffer(final ByteBuffer buffer, final DataOutput stream) throws IOException {
          buffer.flip();
          stream.write(buffer.array(), buffer.arrayOffset(), buffer.remaining());
  
          buffer.clear();
      }