Code example for DataInput

Methods: readIntreadLong

0
	private Integer score;
	 
	 
	@Override 
	public void readFields(DataInput arg0) throws IOException {
		userid = new Long(arg0.readLong());
		score = new Integer(arg0.readInt());
	} 
	 
	@Override 
	public void write(DataOutput arg0) throws IOException {
		arg0.writeLong(userid.longValue());
		arg0.writeInt(score.intValue());
	} 
	 
	@Override 
	public int compareTo(TupleOfUserAndScore arg0) {
		Integer thisScore = this.getScore();
		Integer thatScore = ((TupleOfUserAndScore)arg0).getScore();
		return thisScore.compareTo(thatScore);
Stop searching for code, let great code find you!  Add Codota to your java IDE