|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Streamable
A Streamable object is able to write its state to an output stream and a class implementing Streamable must be able to recreate an instance of the class from an input stream. No information about class name is written to the output stream so it must be known what class type is expected when reading objects back in from an input stream. This gives a space advantage over Serializable but essentially kills polymorphy.
Since the exact class must be known anyway prior to reading, it is encouraged that classes implementing Streamable also provide a constructor of the form:
Streamable(DataInput in) throws IOException;
| Method Summary | |
|---|---|
void |
fromStream(DataInput in)
Reads the internal state of the Streamable object from the input stream. |
void |
toStream(DataOutput out)
Writes the internal state of the Streamable object to the output stream in a format that can later be read by the same Streamble class using the fromStream(java.io.DataInput) method. |
| Method Detail |
|---|
void toStream(DataOutput out)
throws IOException
fromStream(java.io.DataInput) method.
IOException
void fromStream(DataInput in)
throws IOException
UnsupportedOperationException,
and instead implement a constructor as described above.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||