Class CopyStream

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class CopyStream extends ByteArrayOutputStream
This class allows converting an OutputStream into an InputStream without having a duplicated buffer in memory at any time.
  • Constructor Details

    • CopyStream

      public CopyStream()
  • Method Details

    • toInputStream

      public InputStream toInputStream()
      Get an input stream based on the contents of this output stream. Do not use the output stream after calling this method. Consider the output stream as closed after using this method.
      Returns:
      an InputStream