parquet-common/src/main/java/org/apache/parquet/bytes/CapacityByteArrayOutputStream.java
public void writeTo(OutputStream out) throws IOException {
    for (int i = 0; i < slabs.size() - 1; i++) {
      writeToOutput(out, slabs.get(i), slabs.get(i).position());
    }
    writeToOutput(out, currentSlab, currentSlabIndex);
  }
public void writeTo(OutputStream out) throws IOException {
    for (int i = 0; i < slabs.size() - 1; i++) {
      writeToOutput(out, slabs.get(i), slabs.get(i).position());
    }
    writeToOutput(out, currentSlab, currentSlabIndex);
  }
Writes the complete contents of this buffer to the specified output stream argument. the output
stream's write method <code>out.write(slab, 0, slab.length)</code>) will be called once per slab.

@param      out   the output stream to which to write the data.
@exception  IOException  if an I/O error occurs.