code: public synchronized ByteArrayInputStream toByteArrayInputStream()
      throws IOException {
  
          checkFreed();
  
          ByteArrayInputStream inputStream = new ByteArrayInputStream(buf, 0,
              count);
  
          free();
  
          return inputStream;
      }
docs: Performs an effecient (zero-copy) conversion of the data accumulated in
  this output stream to an input stream. <p>
  
  To ensure the future integrity of the resulting input stream, {@link
  #free() free} is invoked upon this output stream as a side-effect.
  
  @return an input stream representing this output stream's accumulated
  data
  @throws java.io.IOException if an I/O error occurs.
  In particular, an <tt>IOException</tt> may be thrown
  if this output stream has been {@link #free() freed}.