Code example for DataInput

Methods: readIntreadLong

0
      return fields;
    } 
 
    @Override 
    public void readFields(DataInput in) throws IOException {
      id = in.readInt();
      Text foo = new Text();
      foo.readFields(in);
      title = foo.toString();
      timestamp = in.readLong();
      foo.readFields(in);
      comments = foo.toString();
      foo.readFields(in);
      text = foo.toString();
    } 
 
    @Override 
    public void write(DataOutput out) throws IOException {
      out.writeInt(id);
      (new Text(title)).write(out);
Stop searching for code, let great code find you!  Add Codota to your java IDE