Code example for DataInput

Methods: readFloatreadIntreadLong

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; 
	} 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE