net.sf.jnati.proc
Class StreamGobbler

java.lang.Object
  extended by java.lang.Thread
      extended by 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

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
StreamGobbler(InputStream in)
           
StreamGobbler(InputStream in, OutputStream out)
          Constructs StreamGobbler, and starts thread.
 
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StreamGobbler

public StreamGobbler(InputStream in,
                     OutputStream out)
Constructs StreamGobbler, and starts thread.

Parameters:
in -
save -
threadName -

StreamGobbler

public StreamGobbler(InputStream in)
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 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.