private void assertSize(int minlength) throws FormatException, EOFException {
  try {
    if (bytesinbuffer < minlength) {
      if (curptr != 0) {
        firstbyteoffset+=curptr;
        System.arraycopy(buffer,curptr,buffer,0,bytesinbuffer);
        curptr=0;
      }
      int err=super.read(buffer,bytesinbuffer,buffer.length - bytesinbuffer);
      if (err == -1) {
        if (available() <= 0) {
          throw new EOFException("BinaryBufferedFile, no bytes at all, trying to read " + minlength);
        }
 else {
          throw new FormatException("BinaryBufferedFile: failed to read " + minlength + " bytes, with "+ bytesinbuffer+ " bytes in the buffer and "+ available()+ " bytes available, have read "+ curptr+ " bytes.");
        }
      }
      bytesinbuffer+=err;
      assertSize(minlength);
    }
  }
 catch (  EOFException e) {
    throw e;
  }
catch (  IOException i) {
    throw new FormatException("assertSize IOException: " + i.getMessage());
  }
}

private void assertSize ( int minlength ) throws FormatException , EOFException { try { if ( bytesinbuffer < minlength ) { if ( curptr != 0 ) { firstbyteoffset += curptr ; System . arraycopy ( buffer , curptr , buffer , 0 , bytesinbuffer ) ; curptr = 0 ; } int err = super . read ( buffer , bytesinbuffer , buffer . length - bytesinbuffer ) ; if ( err == - 1 ) { if ( available ( ) <= 0 ) { throw new EOFException ( "BinaryBufferedFile, no bytes at all, trying to read " + minlength ) ; } else { throw new FormatException ( "BinaryBufferedFile: failed to read " + minlength + " bytes, with " + bytesinbuffer + " bytes in the buffer and " + available ( ) + " bytes available, have read " + curptr + " bytes." ) ; } } bytesinbuffer += err ; assertSize ( minlength ) ; } } catch ( EOFException e ) { throw e ; } catch ( IOException i ) { throw new FormatException ( "assertSize IOException: " + i . getMessage ( ) ) ; } }
forces the buffer to have at least some minimum number of bytes in it .
