Code example for DataInput

Methods: readDouble, readInt

0
    this.value = v;
  } 
 
  @Override 
  public void readFields(DataInput in) throws IOException {
    this.key = in.readInt();
    this.value = in.readDouble();
  } 
 
  @Override 
  public void write(DataOutput out) throws IOException {
    out.writeInt(key);
    out.writeDouble(value);
  } 
 
  public int getKey() { 
    return key;
  } 
 
  public double getValue() { 
    return value;