Package org.apache.hadoop.io
Class CompressedWritable
java.lang.Object
org.apache.hadoop.io.CompressedWritable
- All Implemented Interfaces:
Writable
A base-class for Writables which store themselves compressed and lazily
inflate on field access. This is useful for large objects whose fields are
not be altered during a map or reduce operation: leaving the field data
compressed makes copying the instance from one file to another much
faster.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidMust be called by all methods which access fields to ensure that the data has been uncompressed.final voidreadFields(DataInput in) Deserialize the fields of this object fromin.protected abstract voidSubclasses implement this instead ofreadFields(DataInput).final voidwrite(DataOutput out) Serialize the fields of this object toout.protected abstract voidSubclasses implement this instead ofwrite(DataOutput).
-
Constructor Details
-
CompressedWritable
public CompressedWritable()
-
-
Method Details
-
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.
-
ensureInflated
protected void ensureInflated()Must be called by all methods which access fields to ensure that the data has been uncompressed. -
readFieldsCompressed
Subclasses implement this instead ofreadFields(DataInput).- Parameters:
in- data input.- Throws:
IOException- raised on errors performing I/O.
-
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.
-
writeCompressed
Subclasses implement this instead ofwrite(DataOutput).- Parameters:
out- data output.- Throws:
IOException- raised on errors performing I/O.
-