public void rewind() {
    finishWriting();
    size = 0;
    if (chunks != null) {
      for (ByteBuffer bb : chunks) {
        bb.rewind();
        size += bb.remaining();
      }
    }
    buffer.rewind();
    size += buffer.remaining();
  }
Prepare the contents for sending again
geode-serialization/src/main/java/org/apache/geode/internal/serialization/BufferDataOutputStream.java