| java.lang.Object org.mmbase.util.externalprocess.ProcessClosure
ProcessClosure | public class ProcessClosure (Code) | | ProcessClosure handles the reading of the stdout and stderr of a external
process. A reader can block the calling thread until it is finished reading
(readBlocking). Or the reader can immidiately return when reading of the
stdout and stderr begins (readNonBlocking).
ProcessClosure handles the writing of the stdin of a external process. A
writer can block the calling thread until it is finished writing to the stdin
and reading the stdout and stderr (writeBlocking). Or the writer can
imidiately return when writing to stdin and reading of the stdout and sterr
begins (writeNonBlocking)
author: Nico Klasens (Finalist IT Group) version: $Id: ProcessClosure.java,v 1.4 2006/04/18 13:11:06 michiel Exp $ since: MMBase-1.6 |
error | protected OutputStream error(Code) | | The stream where data is written to when piped from stderr
|
input | protected InputStream input(Code) | | The stream where data is read from to pipe it to stdin
|
name | protected String name(Code) | | the name of the process closure
|
output | protected OutputStream output(Code) | | The stream where data is written to when piped from stdout
|
process | protected Process process(Code) | | the process object representing the external process
|
ProcessClosure | public ProcessClosure(String name, Process process, InputStream inputStream, OutputStream outputStream, OutputStream errorStream)(Code) | | Creates a process reader
.
Parameters: name - the name of the reader Parameters: inputStream - process stdin is read from this stream. Can benull , if not interested in writing the input Parameters: outputStream - process stdout is written to this stream. Can benull , if not interested in reading the output Parameters: errorStream - porcess stderr is written to this stream. Can benull , if not interested in reading the output |
isAlive | public boolean isAlive()(Code) | | Process closure is alive when the external process and writer/reader
threads are still busy
true if is alive and false otherwise |
readBlocking | public void readBlocking()(Code) | | read data from the external process and block the calling thread until
reading is finished
|
readNonBlocking | public void readNonBlocking()(Code) | | read data from the external process without blocking the calling thread
|
terminate | public void terminate()(Code) | | Forces the termination of the launched process
|
waitForProcess | protected void waitForProcess()(Code) | | wait for the external process.to end
|
waitForReaders | protected void waitForReaders()(Code) | | wait for the reading threads to finish copying
|
waitForWriter | protected void waitForWriter()(Code) | | wait for the writing thread to finish copying
|
writeBlocking | public void writeBlocking()(Code) | | write data to the external process and block the calling thread until
writing and reading is finished
|
writeNonBlocking | public void writeNonBlocking()(Code) | | write data to the external process without blocking the calling thread
|
|
|