protected void flushBuffer(SocketChannel sc, ByteBuffer out) throws IOException {
    if (out.position() == 0) {
      return;
    }
    out.flip();
    while (out.remaining() > 0) {
      sc.write(out);
    }
    out.clear();
  }
gets the contents of this stream as a byte[]. The stream should not be written to past this
point until it has been reset.
geode-serialization/src/main/java/org/apache/geode/internal/serialization/BufferDataOutputStream.java