Code example for DataInput

Methods: readFully, readInt

0
   } 
 
   @Override 
   public void readFields(DataInput in) throws IOException {
      try { 
         int length = in.readInt();
         byte b[] = new byte[length];
         in.readFully(b);
         reader.setBuffer(b);
      } catch (EOFException ex) {
         throw new IOException(ex);
      } 
   } 
 
   @Override 
   public void write(DataOutput out) throws IOException {
      byte b[] = writer.getAsByteBlock();
      out.write(b);
   } 
}