code: @Override
    public void write(byte[] b, int start, int length) throws IOException {
      currentDataSegmentBuffer.write(b, start, length);
      flushIfNeeded();
    }
docs: This function makes sure the whole buffer is written into the same data segment.