Search

What is Writable and its methods in hadoop library ?



Writable is an Interface in hadoop library and it provides below two methods for serializing and de-serializing the data.
write(DataOutput out) – Writes data into DataOutput binary stream.
readFields(DataInput in) – Reads data from DataInput binary stream.
Writable Interface

package org.apache.hadoop.io;
import java.io.DataOutput;
import java.io.DataInput;
import java.io.IOException;
public interface Writable
{
void write(DataOutput out) throws IOException;
void readFields(DataInput in) throws IOException;