public static void flushStream(OutputStream out, ByteBuffer outBuf) throws IOException {
    if (outBuf.position() == 0) {
      return;
    }
    assert outBuf.hasArray();
    outBuf.flip();
    out.write(outBuf.array(), outBuf.arrayOffset(), outBuf.remaining());
    outBuf.clear();
  }
Construct a BufferDataOutputStream which uses the byte array provided as its underlying
ByteBuffer
geode-serialization/src/main/java/org/apache/geode/internal/serialization/BufferDataOutputStream.java