public class EventRecordFactory extends Object
Modifier and Type | Field and Description |
---|---|
private boolean |
abortable
instance is abortable or not
|
private List |
listeners
List of the listners that are registred.
|
private static Class[] |
records
contains the classes for all the records we want to parse.
|
private static Map |
recordsMap
cache of the recordsToMap();
|
private static short[] |
sidscache
cache of the return of getAllKnownSids so that we don't have to
expensively get them every time.
|
Constructor and Description |
---|
EventRecordFactory()
Construct an abortable EventRecordFactory.
|
EventRecordFactory(boolean abortable)
Create an EventRecordFactory
|
Modifier and Type | Method and Description |
---|---|
static Record[] |
createRecord(RecordInputStream in)
create a record, if there are MUL records than multiple records
are returned digested into the non-mul form.
|
static short[] |
getAllKnownRecordSIDs() |
protected Iterator |
listeners()
used for unit tests to test the registration of record listeners.
|
void |
processRecords(InputStream in)
Create an array of records from an input stream
|
private static Map |
recordsToMap(Class[] records)
gets the record constructors and sticks them in the map by SID
|
void |
registerListener(ERFListener listener,
short[] sids)
Register a listener for records.
|
private boolean |
throwRecordEvent(Record record)
sends the record event to all registered listeners.
|
private static final Class[] records
private static Map recordsMap
private static short[] sidscache
private List listeners
private boolean abortable
public EventRecordFactory()
EventRecordFactory(boolean)
public EventRecordFactory(boolean abortable)
abortable
- specifies whether the return from the listener
handler functions are obeyed. False means they are ignored. True
means the event loop exits on error.public void registerListener(ERFListener listener, short[] sids)
sids
- an array of Record.sid values identifying the records
the listener will work with. Alternatively if this is "null" then
all records are passed.protected Iterator listeners()
private boolean throwRecordEvent(Record record)
record
- the record to be thrown.public void processRecords(InputStream in) throws RecordFormatException
in
- the InputStream from which the records will be
obtainedRecordFormatException
- on error processing the
InputStreampublic static Record[] createRecord(RecordInputStream in)
public static short[] getAllKnownRecordSIDs()
Copyright © 2015 Open Microscopy Environment