/** * Creates a new execute object using <code>PumpStreamHandler</code> for * stream handling. */ public Execute() { this(new PumpStreamHandler(), null); }
/** * Set the <code>InputStream</code> from which to read the * standard error of the process. * @param is the <code>InputStream</code>. */ public void setProcessErrorStream(InputStream is) { createProcessErrorPump(is, err); }
/** * Set the <code>InputStream</code> from which to read the * standard output of the process. * @param is the <code>InputStream</code>. */ public void setProcessOutputStream(InputStream is) { createProcessOutputPump(is, out); }
/** * Stop the log stream handler. */ @Override public void stop() { super.stop(); FileUtils.close(getErr()); FileUtils.close(getOut()); } }
/** * Creates a stream pumper to copy the given input stream to the * given output stream. * @param is the input stream to copy from. * @param os the output stream to copy to. * @return a thread object that does the pumping. */ protected Thread createPump(InputStream is, OutputStream os) { return createPump(is, os, false); }
@Override public void stop() { super.stop(); FileUtils.close(getErr()); FileUtils.close(getOut()); } }
/** * Create the pump to handle process output. * @param is the <code>InputStream</code>. * @param os the <code>OutputStream</code>. */ protected void createProcessOutputPump(InputStream is, OutputStream os) { outputThread = createPump(is, os); }
/** * Create the ExecuteStreamHandler instance that will be used * during execution. * @return <code>ExecuteStreamHandler</code>. * @throws BuildException on error. */ @Override protected ExecuteStreamHandler createHandler() throws BuildException { //if we have a RedirectorElement, return a decoy return (redirectorElement == null) ? super.createHandler() : new PumpStreamHandler(); }
public void stop() { super.stop(); try { getErr().close(); getOut().close(); } catch (final IOException e) { // plain impossible throw new BuildException(e); } } }
/** * Create the pump to handle error output. * @param is the input stream to copy from. * @param os the output stream to copy to. */ protected void createProcessErrorPump(InputStream is, OutputStream os) { errorThread = createPump(is, os); }
/** * find the handler and instantiate it if it does not exist yet * @return handler for output and error streams */ protected ExecuteStreamHandler getExecuteStreamHandler() { if (this.executeStreamHandler == null) { setExecuteStreamHandler(new PumpStreamHandler(getOutputStream(), getErrorStream())); } return this.executeStreamHandler; }
public void stop() { super.stop(); try { getErr().close(); getOut().close(); } catch (final IOException e) { // plain impossible throw new BuildException(e); } } }
/** * Creates a stream pumper to copy the given input stream to the * given output stream. * @param is the input stream to copy from. * @param os the output stream to copy to. * @param closeWhenExhausted if true close the inputstream. * @return a thread object that does the pumping, subclasses * should return an instance of {@link ThreadWithPumper * ThreadWithPumper}. */ protected Thread createPump(InputStream is, OutputStream os, boolean closeWhenExhausted) { return createPump(is, os, closeWhenExhausted, true); }
try { ByteArrayOutputStream out = new ByteArrayOutputStream(); Execute exe = new Execute(new PumpStreamHandler(out)); exe.setCommandline(getProcEnvCommand());
/** * Set the <code>OutputStream</code> by means of which * input can be sent to the process. * @param os the <code>OutputStream</code>. */ public void setProcessInputStream(OutputStream os) { if (input != null) { inputThread = createPump(input, os, true, nonBlockingRead); } else { FileUtils.close(os); } }
/** * Create the StreamHandler to use with our Execute instance. * * @return the execute stream handler to manage the input, output and error * streams. * * @throws BuildException * if the execute stream handler cannot be created. */ public ExecuteStreamHandler createHandler() throws BuildException { createStreams(); final boolean nonBlockingRead = input == null && inputString == null; return new PumpStreamHandler(getOutputStream(), getErrorStream(), getInputStream(), nonBlockingRead); }
ExecuteStreamHandler handler = new PumpStreamHandler(dummyOut); handler.setProcessErrorStream(process.getErrorStream()); handler.setProcessOutputStream(process.getInputStream());
errorstream = new LogOutputStream(this, Project.MSG_DEBUG); streamhandler = new PumpStreamHandler(outputstream, errorstream);
log(commandLine.describeCommand(), Project.MSG_VERBOSE); try { result = runCmd(commandLine, new PumpStreamHandler(fos, new LogOutputStream(this, Project.MSG_WARN))); } finally {
final Execute exe = new Execute(new PumpStreamHandler(out, err)); exe.setAntRun(getProject());