input
Class BinaryEventsReader

java.lang.Object
  extended by input.BinaryEventsReader
All Implemented Interfaces:
ExternalEventsReader

public class BinaryEventsReader
extends java.lang.Object
implements ExternalEventsReader

Reads External Events from a binary file. Can also create binary files from a list of external events.


Field Summary
static java.lang.String BINARY_EXT
          Extension of binary external events file
 
Constructor Summary
BinaryEventsReader(java.io.File eventsFile)
          Constructor.
 
Method Summary
 void close()
          Closes the input file streams of the reader.
static boolean isBinaryEeFile(java.io.File file)
          Checks if the given file is a binary external events file
 java.util.List<ExternalEvent> readEvents(int nrof)
          Read events from a binary file created with storeBinaryFile method
static void storeToBinaryFile(java.lang.String fileName, java.util.List<ExternalEvent> events)
          Stores the events to a binary file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BINARY_EXT

public static final java.lang.String BINARY_EXT
Extension of binary external events file

See Also:
Constant Field Values
Constructor Detail

BinaryEventsReader

public BinaryEventsReader(java.io.File eventsFile)
Constructor.

Parameters:
eventsFile - The file where the events are read
Method Detail

readEvents

public java.util.List<ExternalEvent> readEvents(int nrof)
Read events from a binary file created with storeBinaryFile method

Specified by:
readEvents in interface ExternalEventsReader
Parameters:
nrof - Maximum number of events to read
Returns:
Events in an ArrayList (empty list if didn't read any)
See Also:
storeToBinaryFile(String, List)

isBinaryEeFile

public static boolean isBinaryEeFile(java.io.File file)
Checks if the given file is a binary external events file

Parameters:
file - The file to check
Returns:
True if the file is a binary ee file, false if not

storeToBinaryFile

public static void storeToBinaryFile(java.lang.String fileName,
                                     java.util.List<ExternalEvent> events)
                              throws java.io.IOException
Stores the events to a binary file

Parameters:
fileName - Path to the file where the events are stored
events - List of events to store
Throws:
java.io.IOException - if something in storing went wrong

close

public void close()
Description copied from interface: ExternalEventsReader
Closes the input file streams of the reader.

Specified by:
close in interface ExternalEventsReader