net.sf.jnati.proc
Class StreamGobbler
java.lang.Object
java.lang.Thread
net.sf.jnati.proc.StreamGobbler
- All Implemented Interfaces:
- Runnable
public class StreamGobbler
- extends Thread
Class that gobbles content from (optionally saving it) an input stream.
- Author:
- Sam Adams
|
Method Summary |
byte[] |
getCachedBytes()
|
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, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
StreamGobbler
public StreamGobbler(InputStream in,
OutputStream out)
- Constructs StreamGobbler, and starts thread.
- Parameters:
in - save - threadName -
StreamGobbler
public StreamGobbler(InputStream in)
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 interface Runnable- Overrides:
run in class 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 Exception getError()
Copyright © 2007-2011 Sam Adams. All Rights Reserved.