gate.util
Class ObjectWriter
java.lang.Object
|
+--java.lang.Thread
|
+--gate.util.ObjectWriter
- All Implemented Interfaces:
- Runnable
- public class ObjectWriter
- extends Thread
Writes an object to an PipedOutputStream wich can be connected to a
PipedInputStream.
Before writting the object it also writes it in a buffer and finds
out its size so it can be reported via getSize method.
All read/writes occur in separate threads to avoid a deadlock.
Method Summary |
InputStream |
getInputStream()
Returns a PipedInputStream from which the object given as parameter for
the constructor can be read. |
int |
getSize()
Obtains the object size. |
void |
run()
Writes all the buffers to the output stream |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
ObjectWriter
public ObjectWriter(Object obj)
throws IOException
getInputStream
public InputStream getInputStream()
- Returns a PipedInputStream from which the object given as parameter for
the constructor can be read.
- Returns:
- a PipedInputStream connected to PipedOutputStream which writes
the object which this ObjectWriter was built for.
getSize
public int getSize()
- Obtains the object size.
- Returns:
- the size of the object recieved as parameter for the constructor.
run
public void run()
- Writes all the buffers to the output stream
- Specified by:
run
in interface Runnable
- Overrides:
run
in class Thread