Class InOutCopier

  • All Implemented Interfaces:
    Runnable

    public class InOutCopier
    extends Thread
    Copies from an input stream to an output stream using a Thread. example:
     InputStream a = getInputStream();
     OutputStream b = getOutputStream();
     InOutCopier copier = new InOutCopier(a, b);
     copier.start();
     <do stuff that writes to the inputstream>
     
    • Constructor Detail

      • InOutCopier

        public InOutCopier​(InputStream is,
                           OutputStream os)
                    throws IOException
        Create a copier from an inputstream to an outputstream
        Parameters:
        is - The stream to copy from
        os - the stream to copy to
        Throws:
        IOException
    • Method Detail

      • close

        public void close()
        Force close the stream without waiting for EOF on the source
      • start

        public void start()
        Start the thread and wait to make sure its really started
        Overrides:
        start in class Thread
      • run

        public void run()
        Copies from the inputstream to the outputstream until EOF on the inputstream or explicitly closed
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread
        See Also:
        close()