public void sendTo(OutputStream out, ByteBuffer outBuf) throws IOException {
    finishWriting();
    if (chunks != null) {
      for (ByteBuffer bb : chunks) {
        sendTo(out, outBuf, bb);
      }
    }
    sendTo(out, outBuf, buffer);
    flushStream(out, outBuf);
  }
Write the contents of this stream to the specified stream using outBuf if a buffer is needed.
geode-core/src/main/java/org/apache/geode/internal/HeapDataOutputStream.java