Code example for DataInput

Methods: readBoolean

0
  /** 
   * Read the binary representation of the counter 
   */ 
  @Override 
  public synchronized void readFields(DataInput in) throws IOException {
    name = Text.readString(in);
    if (in.readBoolean()) {
      displayName = Text.readString(in);
    } else { 
      displayName = name;
    } 
    value = WritableUtils.readVLong(in);
  } 
     
  /** 
   * Write the binary representation of the counter 
   */ 
  @Override 
  public synchronized void write(DataOutput out) throws IOException {
    Text.writeString(out, name);
    boolean distinctDisplayName = ! name.equals(displayName);