/** * Set the input stream from which to read the standard error of the child. */ public void setChildErrorStream(final InputStream in) { assert in != null; if (streams.err != null) { createChildErrorPump(in, streams.err); } }
/** * Set the input stream from which to read the standard output of the child. */ public void setChildOutputStream(final InputStream in) { assert in != null; createChildOutputPump(in, streams.out); }
/** * Creates a stream pumper to copy the given input stream to the given output stream. */ protected Thread createPump(final InputStream in, final OutputStream out) { assert in != null; assert out != null; return createPump(in, out, false); }
/** * Attach to a child streams from the given process. * * @param p The process to attach to. */ public void attach(final Process p) { assert p != null; setChildInputStream(p.getOutputStream()); setChildOutputStream(p.getInputStream()); setChildErrorStream(p.getErrorStream()); } /**
/** * Set the output stream by means of which input can be sent to the child. */ public void setChildInputStream(final OutputStream out) { assert out != null; if (streams.in != null) { inputPump = createInputPump(streams.in, out, true); } else { Closer.close(out); } }
/** * Create the pump to handle error output. */ protected void createChildErrorPump(final InputStream in, final OutputStream out) { assert in != null; assert out != null; errorThread = createPump(in, out); }
/** * Create the pump to handle child output. */ protected void createChildOutputPump(final InputStream in, final OutputStream out) { assert in != null; assert out != null; outputThread = createPump(in, out); }