Created
November 23, 2010 16:41
-
-
Save kzk/712066 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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