Package org.apache.hadoop.io
Class LongWritable
java.lang.Object
org.apache.hadoop.io.LongWritable
- All Implemented Interfaces:
Comparable<LongWritable>,Writable,WritableComparable<LongWritable>
@Public
@Stable
public class LongWritable
extends Object
implements WritableComparable<LongWritable>
A WritableComparable for longs.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classorg.apache.hadoop.io.LongWritable.ComparatorA Comparator optimized for LongWritable.static classorg.apache.hadoop.io.LongWritable.DecreasingComparatorA decreasing Comparator optimized for LongWritable. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompares two LongWritables.booleanReturns true iffois a LongWritable with the same value.longget()Return the value of this LongWritable.inthashCode()voidreadFields(DataInput in) Deserialize the fields of this object fromin.voidset(long value) Set the value of this LongWritable.toString()voidwrite(DataOutput out) Serialize the fields of this object toout.
-
Constructor Details
-
LongWritable
public LongWritable() -
LongWritable
public LongWritable(long value)
-
-
Method Details
-
set
public void set(long value) Set the value of this LongWritable.- Parameters:
value- value.
-
get
public long get()Return the value of this LongWritable.- Returns:
- value of this LongWritable.
-
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.
-
equals
Returns true iffois a LongWritable with the same value. -
hashCode
public int hashCode() -
compareTo
Compares two LongWritables.- Specified by:
compareToin interfaceComparable<LongWritable>
-
toString
-