Code example for DataInput

Methods: readShort

  /** {@inheritDoc} */ 
  public void readFields(DataInput in) throws IOException {
    name = UTF8.readString(in);
    storageID = UTF8.readString(in);
    // the infoPort read could be negative, if the port is a large number (more 
    // than 15 bits in storage size (but less than 16 bits). 
    // So chop off the first two bytes (and hence the signed bits) before  
    // setting the field. 
    this.infoPort = in.readShort() & 0x0000ffff;
Contextual code suggestions in your IDE  Get Codota for Java