/** * Creates a stream pumper to copy the given input stream to the * given output stream. * * @param in The input stream to copy from. * @param out The output stream to copy to. * @param closeWhenExhausted If true close the inputstream. * @return A thread object that does the pumping. */ protected Thread createPump(final InputStream in, final OutputStream out, final boolean closeWhenExhausted) { assert in != null; assert out != null; final Thread result = new Thread(new StreamPumper(in, out, closeWhenExhausted)); result.setDaemon(true); return result; }
/** * Creates a stream pumper to copy the given input stream to the * given output stream. Used for standard input. */ protected StreamPumper createInputPump(final InputStream in, final OutputStream out, final boolean closeWhenExhausted) { assert in != null; assert out != null; StreamPumper pumper = new StreamPumper(in, out, closeWhenExhausted); pumper.setAutoFlush(true); return pumper; } }