public byte[] readBytes(int howmany,boolean allowless) throws EOFException, FormatException {
  byte foo[]=new byte[howmany];
  int gotsofar=0;
  try {
    while (gotsofar < howmany) {
      int err=read(foo,gotsofar,howmany - gotsofar);
      if (err == -1) {
        if (allowless) {
          byte retval[]=new byte[gotsofar];
          System.arraycopy(foo,0,retval,0,gotsofar);
          return retval;
        }
 else {
          if (gotsofar > 0) {
            throw new FormatException("EOF while reading");
          }
 else {
            throw new EOFException();
          }
        }
      }
      gotsofar+=err;
    }
  }
 catch (  IOException i) {
    throw new FormatException("IOException reading file: " + i.getMessage());
  }
  return foo;
}

public byte [ ] readBytes ( int howmany , boolean allowless ) throws EOFException , FormatException { byte foo [ ] = new byte [ howmany ] ; int gotsofar = 0 ; try { while ( gotsofar < howmany ) { int err = read ( foo , gotsofar , howmany - gotsofar ) ; if ( err == - 1 ) { if ( allowless ) { byte retval [ ] = new byte [ gotsofar ] ; System . arraycopy ( foo , 0 , retval , 0 , gotsofar ) ; return retval ; } else { if ( gotsofar > 0 ) { throw new FormatException ( "EOF while reading" ) ; } else { throw new EOFException ( ) ; } } } gotsofar += err ; } } catch ( IOException i ) { throw new FormatException ( "IOException reading file: " + i . getMessage ( ) ) ; } return foo ; }
read from the file .
