@SuppressWarnings("unchecked") public List<ExternalEvent> readEvents(int nrof){
  ArrayList<ExternalEvent> events=new ArrayList<ExternalEvent>(nrof);
  if (eventsLeft == 0) {
    return events;
  }
  try {
    for (int i=0; i < nrof && eventsLeft > 0; i++) {
      events.add((ExternalEvent)in.readObject());
      eventsLeft--;
    }
    if (eventsLeft == 0) {
      in.close();
    }
  }
 catch (  Exception e) {
    throw new SimError(e);
  }
  return events;
}

@ SuppressWarnings ( "unchecked" ) public List < ExternalEvent > readEvents ( int nrof ) { ArrayList < ExternalEvent > events = new ArrayList < ExternalEvent > ( nrof ) ; if ( eventsLeft == 0 ) { return events ; } try { for ( int i = 0 ; i < nrof && eventsLeft > 0 ; i ++ ) { events . add ( ( ExternalEvent ) in . readObject ( ) ) ; eventsLeft -- ; } if ( eventsLeft == 0 ) { in . close ( ) ; } } catch ( Exception e ) { throw new SimError ( e ) ; } return events ; }
read events from a binary file created with storebinaryfile method
