- All Implemented Interfaces:
public class ISPT extends java.lang.ThreadA helper class performing
Threadmanagement for class
ISPT: InputStream Printing Thread
Helper Class for Torello.Java.OSCommandsThis class functions in a support role to both
OSResponse. These, in turn, are the abstract parent-class and also a helper-support class for Operating-System Process-Invocation classes:
If the methods in this class do not appear to be 'generally applicable utilities' that is because they are specifically tailored to reading Process-Output (Standard-Out & Standard-Error) from Operating System calls.
The two helpers used by the
OSCommandsSuite of Tools are:
ISPT. These two classes do nothing more than streamline the multi-threaded reader code for reading from a
java.lang.ProcessObject as it executes an Operating-System call.
This class is used to asynchronously print
Stringdata from both
Terminal Standard-Outputand also
Terminal Standard-Errorto an output
java.lang.Appendable. All it is is an extension of Java
class Threadthat receives an instance of
InputStreamto its constructor, and, when started as a
Thread, prints the contents of the
InputStreamto a user provided
Internally, this class simply builds a
java.lang.Runnablethat will execute when the
'this' Thread's Thread.start()method is invoked. This class was designed for use with the
'Completed'thread-monitor system for printing output from one
InputStreamto a user provided output
Appendablemechanism - asynchronously. The need for 'asynchronous' printing arose out of using the
class java.lang.Processwhich has the behaviour of sending output to two different text-streams (
Standard-Error) at the same time. Though is usually not a problem, depending upon which O/S the JVM is running, thread-freezing may occur where the entire JVM halts because one of the streams isn't being serviced. The only way to prevent such problems is to use asynchronously print monitoring.
Retrieve the Number of chars that Were Read Modifier and Type Method
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
public ISPT(java.io.InputStream inputStream, java.lang.Appendable appendable, Completed completed, java.lang.String name)This shall build a
Threadthat asynchronously prints text read from an
InputStreamdirectly to the provided
InputStreamto be read.
appendable- Where the read text shall be sent
completed- This class only works in coordination with the
class 'Completed'. This class is used to allow the user to
'wait'until this independent
Threadhas run to completion.
name- Since this class (
ISPT) inherits from
class Thread), it has a
Thread'shave names. The
nameof the this
Threadwill be set to the value provided to this parameter.
public int numCharsRead()This returns a count on the number of characters that have been read from the
- Number of characters that have been read from the
- Exact Method Body: