Code example for DataOutput

Methods: writeFloat, writeInt, writeLong

0
	public String toString() {
		return id + " " + avgRating + " " + rate;
	} 
 
	public void write(DataOutput out) throws IOException {
		out.writeLong(id);
		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;