public interface ExternalizableLite extends Serializable
The readExternal and writeExternal methods of the ExternalizableLite
interface are implemented by a class to give the class complete
control over the format and contents of the stream for an object. Unlike
the Externalizable
interface, these methods operate on more
primitive DataInput and DataOutput streams, allowing for significantly
better performance, but often requiring more effort to implement.
These methods must explicitly coordinate with the supertype to save its state. When an ExternalizableLite object is reconstructed, an instance is created using the public no-arg constructor, then the readExternal method called. Therefore, in addition to the methods listed below, a public default constructor is required.
Since a graph traversal is not managed by the stream, only uni-directional object graphs (e.g. object trees) can be serialized using this approach.
Note: it is extremely important that objects that are equivalent according to their "equals()" implementation produce equivalent serialized streams. Violating this relationship will result in non-deterministic behavior for many Coherence services.
Modifier and Type | Method and Description |
---|---|
void |
readExternal(DataInput in)
Restore the contents of this object by loading the object's state from
the passed DataInput object.
|
void |
writeExternal(DataOutput out)
Save the contents of this object by storing the object's state into
the passed DataOutput object.
|
void readExternal(DataInput in) throws IOException
in
- the DataInput stream to read data from in order to restore
the state of this objectIOException
- if an I/O exception occursNotActiveException
- if the object is not in its initial
state, and therefore cannot be deserialized intovoid writeExternal(DataOutput out) throws IOException
out
- the DataOutput stream to write the state of this object toIOException
- if an I/O exception occurs