|
JavaGantt 2011.1 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
eu.beesoft.gaia.util.InputStreamGobbler
public class InputStreamGobbler
A special implementation of the InputStream.
The instance creates in its constructor a new thread and starts itself in this thread. It reads
in method run()
invoked by this thread data from the input stream given as a argument to
the instance constructor, and stores data to the internal byte array. When the array size exceeds
internal limit, the instance creates temporary file and stores the loaded data in this file.
All loaded data can be read with any InputStream read{} method. These methods block while all data from the source input stream are loaded.
If the instance creates a temporary file, this file is deleted in method close()
invoked
by programmer or on Java VM exit.
This class is usable when you need load data from other source and process it after all data are loaded, or if you need to load such data but you don't want to process it.
Constructor Summary | |
---|---|
InputStreamGobbler(java.io.InputStream is)
Creates an instance of InputStreamGobbler. |
Method Summary | |
---|---|
void |
close()
Closes this input stream. |
java.lang.Thread |
getThread()
Returns the thread in which is this instance running. |
int |
read()
Implementation of InputStream.read() method. |
void |
run()
Implementation of Runnable interface, invoked from the thread internally started by this instance. |
Methods inherited from class java.io.InputStream |
---|
available, mark, markSupported, read, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InputStreamGobbler(java.io.InputStream is)
is
- - input stream to gobbleMethod Detail |
---|
public java.lang.Thread getThread()
public void run()
run
in interface java.lang.Runnable
public int read() throws java.io.IOException
run()
method. Blocks until run() in the separate thread is running.
read
in class java.io.InputStream
java.io.IOException
- if some error occurspublic void close() throws java.io.IOException
run()
method.
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
- if some error occurs
|
JavaGantt 2011.1 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |