public static String readStringFixedSize(final DataInput in,int size) throws IOException {
  byte[] b=new byte[size];
  in.readFully(b);
  int n=b.length;
  while (n > 0 && b[n - 1] == 0)   --n;
  return toString(b,0,n);
}

public static String readStringFixedSize ( final DataInput in , int size ) throws IOException { byte [ ] b = new byte [ size ] ; in . readFully ( b ) ; int n = b . length ; while ( n > 0 && b [ n - 1 ] == 0 ) -- n ; return toString ( b , 0 , n ) ; }
reads a fixed - size field and interprets it as a string padded with zeros .
