Package com.glitchybyte.glib.process
Class GProcessOutputCollectorTask
java.lang.Object
com.glitchybyte.glib.concurrent.GTask
com.glitchybyte.glib.process.GProcessOutputCollectorTask
- All Implemented Interfaces:
Runnable
Console output collector for capturing an external process output.
This class uses a buffer to accumulate lines, when lines are requested the whole buffer is returned and a new buffer created for new lines.
-
Constructor Summary
ConstructorsConstructorDescriptionGProcessOutputCollectorTask(Process process, int maxOutputBufferLines) Creates an output collector. -
Method Summary
Methods inherited from class com.glitchybyte.glib.concurrent.GTask
awaitDone, getTaskRunner, getTaskThreadName, interrupt, isDone, setTaskRunner, started
-
Constructor Details
-
GProcessOutputCollectorTask
Creates an output collector.- Parameters:
process- Process to which attach this collector.maxOutputBufferLines- Max lines to hold in memory. If output exceeds this quantity before being queried, older lines will be lost. A value of zero will prevent any collection.
-
-
Method Details
-
run
public void run()Collector runner. This must be called on a different thread. -
getOutput
Returns all collected output until this moment. Recreate collection buffer.- Returns:
- All collected lines until this moment.
-