|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object CTL.Streams.IStream
public class IStream
"Intelligent" Stream: This special stream is handled just like an ObjectOutputStream, however, it saves information about the data which was written to it. Therefore, it is an easy interface to pass around data from different sources to one ObjectOutputStream and it is also capable of writing a "signature" string to the stream which can be interpreted by the readFromStream() call. This makes it possible to pass around larger amounts of arbitrary data via Object*putStreams w/o recreating the structure of the stream in code on both ends. It is also possible to query the size of the whole stream. Furthermore, the stream can write the data to other streams while keeping the data inside, which makes it ideal for debugging stream related applications.
Field Summary | |
---|---|
private SerialIn |
in
Input stream for the internal storage |
private java.util.LinkedList<java.lang.Class> |
list
LinkedList of types of the stored data |
private SerialOut |
out
Output stream for the internal storage |
private int |
size
Size of the stream |
Constructor Summary | |
---|---|
IStream()
Create a new IStream |
Method Summary | ||
---|---|---|
void |
close()
Close the stream |
|
void |
flush()
Flush the stream |
|
void |
readFromStream(SerialIn istr)
Read data from another IStream |
|
private java.lang.Object |
readType(java.lang.Class type)
Read data from this stream |
|
static java.lang.Object |
readType(SerialIn input,
java.lang.Class typ)
Read data from an OIStream |
|
void |
reset()
Reset the internal storage (via Piped*Streams) |
|
int |
streamSize()
Retrieve the size of the data this stream holds |
|
java.lang.String |
toString()
Retrieve a string representation of this object |
|
|
write(T val)
Write data to the stream |
|
void |
writeToIStream(SerialOut ostr)
Write the data of this stream to another IStream while keeping it |
|
void |
writeToIStream(SerialOut ostr,
boolean keep)
Write the data of this stream to another IStream |
|
void |
writeToStream(SerialOut ostr)
Write the data of this stream to another without keeping it |
|
void |
writeToStream(SerialOut ostr,
boolean keep)
Write the contents of this stream to another one |
|
static
|
writeType(SerialOut outp,
T stuff)
Write data to an OOStream |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.util.LinkedList<java.lang.Class> list
private SerialIn in
private SerialOut out
private int size
Constructor Detail |
---|
public IStream() throws java.io.IOException, CTLException
java.io.IOException
CTLException
Method Detail |
---|
public void reset() throws java.io.IOException, CTLException
java.io.IOException
CTLException
public void flush() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
public <T> void write(T val) throws java.io.IOException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, CTLException
val
- Value
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
CTLException
public static <T> void writeType(SerialOut outp, T stuff) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
outp
- Stream to write tostuff
- Data to write
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public static java.lang.Object readType(SerialIn input, java.lang.Class typ) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
input
- Stream to read fromtyp
- Type to read
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
private java.lang.Object readType(java.lang.Class type) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
type
- Type to read
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public java.lang.String toString()
toString
in class java.lang.Object
public void writeToStream(SerialOut ostr, boolean keep)
ostr
- Target streamkeep
- Whether to keep the data in this streampublic void writeToStream(SerialOut ostr)
ostr
- Target streampublic void writeToIStream(SerialOut ostr)
ostr
- Target streampublic void writeToIStream(SerialOut ostr, boolean keep)
ostr
- Target streamkeep
- True if the data should be kept, false otherwise.public void readFromStream(SerialIn istr)
istr
- Source streampublic int streamSize()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |