code: public void writeTo(OutputStream out) throws IOException {
          // Check if we have a list of buffers
          if (buffers != null) {
              Iterator iter = buffers.iterator();
  
              while (iter.hasNext()) {
                  byte[] bytes = (byte[]) iter.next();
                  out.write(bytes, 0, blockSize);
              }
          }
  
          // write the internal buffer directly
          out.write(buffer, 0, index);
      }
docs: Public