public interface Encodable
This interface provides an alternative to the
DatatypeCodecinterface where the codec behaviour can be inlined directly into the datatype code. This interface can be used as a substitute for
FastSerializablewhen the additional utility functions provided to codecs are necessary.
Encodablemust provide a public constructor that takes, in this order:
Object state is read from the
ClassLoaderargument can be used to resolve any application-specific classes stored in the stream, and the
DecoderUtilscan be used to restore certain SLEE-specific types. The constructor may throw
In order for Rhino to utilise the function of the
Encodableinterface, a CMP field must be declared with a type of at least
Encodable- a CMP field declared with a type of
Objectwill fall back to Rhino’s default serialisation behaviour. Serialisation efficiency will be gained by storing into a CMP field an object of exactly the declared CMP field type. Rhino will correctly handle the case if at runtime a subclass of the declared CMP field type is stored into the CMP field, however in this case reflection must be used during deserialisation to instantiate an object of the stored class, as it cannot be known at deploy time.
FastSerializable, there is no handling of shared references to objects. If an
Encodableobject is encountered twice during serialisation, then two copies of the object will exist upon deserialisation.
- Rhino 2.4.0
- See Also:
void encode(DataOutput out, EncoderUtils utils) throws IOException
Encode the state of this object to the given data output stream.
out- the data output stream to encode the value to.
utils- additional utility encoding functions that may be useful to the encoder.
IOException- if an I/O error occurs.
- Rhino 2.4.0