Package net.sf.jnati.proc
Class StreamGobbler
- java.lang.Object
-
- java.lang.Thread
-
- net.sf.jnati.proc.StreamGobbler
-
- All Implemented Interfaces:
java.lang.Runnable
public class StreamGobbler extends java.lang.Thread
Class that gobbles content from (optionally saving it) an input stream.- Author:
- Sam Adams
-
-
Constructor Summary
Constructors Constructor Description StreamGobbler(java.io.InputStream in)
StreamGobbler(java.io.InputStream in, java.io.OutputStream out)
Constructs StreamGobbler, and starts thread.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getCachedBytes()
java.lang.Exception
getError()
boolean
isError()
boolean
isStarted()
Returns true if the StreamGobbler has been started (even if it has now finished), and otherwise false.void
run()
Reads content from input stream, until either the end of the stream is reached, or the thread is interrupted.void
setCacheSize(int n)
-
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, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Method Detail
-
setCacheSize
public void setCacheSize(int n)
-
run
public void run()
Reads content from input stream, until either the end of the stream is reached, or the thread is interrupted.- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
isStarted
public boolean isStarted()
Returns true if the StreamGobbler has been started (even if it has now finished), and otherwise false.- Returns:
-
getCachedBytes
public byte[] getCachedBytes()
-
isError
public boolean isError()
-
getError
public java.lang.Exception getError()
-
-