Package org.apache.hadoop.io
Class ArrayWritable
java.lang.Object
org.apache.hadoop.io.ArrayWritable
- All Implemented Interfaces:
Writable
A Writable for arrays containing instances of a class. The elements of this
writable must all be instances of the same class. If this writable will be
the input for a Reducer, you will need to create a subclass that sets the
value to be of the proper type.
For example:
public class IntArrayWritable extends ArrayWritable {
public IntArrayWritable() {
super(IntWritable.class);
}
}
-
Constructor Summary
ConstructorsConstructorDescriptionArrayWritable(Class<? extends Writable> valueClass) ArrayWritable(Class<? extends Writable> valueClass, Writable[] values) ArrayWritable(String[] strings) -
Method Summary
Modifier and TypeMethodDescriptionWritable[]get()voidreadFields(DataInput in) Deserialize the fields of this object fromin.voidtoArray()toString()String[]voidwrite(DataOutput out) Serialize the fields of this object toout.
-
Constructor Details
-
ArrayWritable
-
ArrayWritable
-
ArrayWritable
-
-
Method Details
-
getValueClass
-
toStrings
-
toArray
-
set
-
get
-
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.
-
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.
-
toString
-