Package loci.poi.hssf.eventmodel
Class EventRecordFactory
- java.lang.Object
-
- loci.poi.hssf.eventmodel.EventRecordFactory
-
public class EventRecordFactory extends Object
Event-based record factory. As opposed to RecordFactory this refactored version throws record events as it comes accross the records. I throws the "lazily" one record behind to ensure that ContinueRecords are processed first.- Author:
- Andrew C. Oliver (acoliver@apache.org) - probably to blame for the bugs (so yank his chain on the list), Marc Johnson (mjohnson at apache dot org) - methods taken from RecordFactory, Glen Stampoultzis (glens at apache.org) - methods taken from RecordFactory, Csaba Nagy (ncsaba at yahoo dot com)
-
-
Constructor Summary
Constructors Constructor Description EventRecordFactory()
Construct an abortable EventRecordFactory.EventRecordFactory(boolean abortable)
Create an EventRecordFactory
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 streamvoid
registerListener(ERFListener listener, short[] sids)
Register a listener for records.
-
-
-
Constructor Detail
-
EventRecordFactory
public EventRecordFactory()
Construct an abortable EventRecordFactory. The same as calling new EventRecordFactory(true)- See Also:
EventRecordFactory(boolean)
-
EventRecordFactory
public EventRecordFactory(boolean abortable)
Create an EventRecordFactory- Parameters:
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.
-
-
Method Detail
-
registerListener
public void registerListener(ERFListener listener, short[] sids)
Register a listener for records. These can be for all records or just a subset.- Parameters:
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.
-
listeners
protected Iterator listeners()
used for unit tests to test the registration of record listeners.- Returns:
- Iterator of ERFListeners
-
processRecords
public void processRecords(InputStream in) throws RecordFormatException
Create an array of records from an input stream- Parameters:
in
- the InputStream from which the records will be obtained- Throws:
RecordFormatException
- on error processing the InputStream
-
createRecord
public static Record[] createRecord(RecordInputStream in)
create a record, if there are MUL records than multiple records are returned digested into the non-mul form.
-
getAllKnownRecordSIDs
public static short[] getAllKnownRecordSIDs()
- Returns:
- an array of all the SIDS for all known records
-
-