Skip to content

Instantly share code, notes, and snippets.

@rclayton-the-terrible
Created April 23, 2012 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rclayton-the-terrible/2473986 to your computer and use it in GitHub Desktop.
Save rclayton-the-terrible/2473986 to your computer and use it in GitHub Desktop.
Hadoop Writable
public class MyWritable implements Writable {
// Some data
private int counter;
private long timestamp;
public void write(DataOutput out) throws IOException {
out.writeInt(counter);
out.writeLong(timestamp);
}
public void readFields(DataInput in) throws IOException {
counter = in.readInt();
timestamp = in.readLong();
}
public static MyWritable read(DataInput in) throws IOException {
MyWritable w = new MyWritable();
w.readFields(in);
return w;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment