Hadoop longwritable

hadoop longwritable


LongWritable(long value)

Also Know about File system command hadoop fs -put 


Modifier and type                    Method                                         Description
int                              compareTo(LongWritable o)       Compares two LongWritables

boolean                      equals(Object o)        Returns true iff o is a LongWritable with the same value

long                                  get()                                 Return the value of this LongWritable

int                                    hashCode() 

void                      readFields(DataInput in)       Deserialize the fields of this object from in

void                         set(long value)                           the value of this LongWritable

String                             toString() 

void                      write(DataOutput out)              Serialize the fields of this object to out

Use of hadoop fs -chmod

Hapdoop needs to be able to serialise data in and out of Java types via DataInput and DataOutput objects (IO Streams usually) . The Writable classes do this by implementing two methods `write(DataOuput) and readFields(DataInput).

Specifically LongWritable is a Writable class that wraps a java long.

Most of the time (especially just starting out) you can mentally replace c. If you get to defining your own datatypes you will start to become every familiar with implementing the writable interface:

Which looks some thing like:

public interface Writable {

       public void write(DataOutput out) throws IOException;

       public void readFields(DataInput in) throws IOException;

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

compareTo method
public int compareTo(LongWritable o)

Compares two LongWritables

equals method
public boolean equals(Object o)

Returns true iff o is a LongWritable with the same value

Related Posts