|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Streamer<E>
A Streamer is capable of writing and reading objects of
a specific class to and from streams. The Streamer must
ensure that the format written by the toStream method
is compatible with the fromStream method. Moreover,
all data written by the toStream method must
be read by the fromStream method, so that the position
of the stream is ready for the next Streamer.
Compared to Serializable the advantage of using
Streamers is that the identity of the class is not
written to the stream, thus making the output more compact. Furthermore,
multiple Streamers can be defined for the same class so
that the output format is configurable and not fixed at one representation.
Note, that if a Streamer requires some kind of polymorphy,
it can simply write the identity of the class to the output itself
if needed.
| Method Summary | |
|---|---|
E |
fromStream(DataInput in)
Reads the internal state of the object from the input stream. |
void |
toStream(DataOutput out,
E obj)
Writes the internal state of the object to the output stream in a format that can later be read by the same Streamer
using the fromStream method. |
| Method Detail |
|---|
void toStream(DataOutput out,
E obj)
throws IOException
Streamer
using the fromStream method.
IOException
E fromStream(DataInput in)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||