Package org.apache.hadoop.io
Class VersionedWritable
java.lang.Object
org.apache.hadoop.io.VersionedWritable
- All Implemented Interfaces:
Writable
A base class for Writables that provides version checking.
This is useful when a class may evolve, so that instances written by the
old version of the class may still be processed by the new version. To
handle this situation, readFields(DataInput)
implementations should catch VersionMismatchException.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract bytevoidreadFields(DataInput in) Deserialize the fields of this object fromin.voidwrite(DataOutput out) Serialize the fields of this object toout.
-
Constructor Details
-
VersionedWritable
public VersionedWritable()
-
-
Method Details
-
getVersion
public abstract byte getVersion()- Returns:
- Return the version number of the current implementation.
-
write
Description copied from interface:WritableSerialize the fields of this object toout.- Specified by:
writein interfaceWritable- Parameters:
out-DataOuputto serialize this object into.- Throws:
IOException- any other problem for write.
-
readFields
Description copied from interface:WritableDeserialize the fields of this object fromin.For efficiency, implementations should attempt to re-use storage in the existing object where possible.
- Specified by:
readFieldsin interfaceWritable- Parameters:
in-DataInputto deseriablize this object from.- Throws:
IOException- any other problem for readFields.
-