Code example for DataInput

Methods: readFloat, readInt, readLong

0
		out.writeFloat(avgRating);
		out.writeInt(rate);
	} 
 
	public void readFields(DataInput in) throws IOException {
		this.id = in.readLong();
		this.avgRating = in.readFloat();
		this.rate = in.readInt();
	} 
 
	public int compareTo(PostingUser other) {
		if (this.id < other.id)
			return -1; 
		else if (this.id > other.id)
			return 1; 
		else 
			return 0; 
	} 
}