org.apache.poi.hssf.eventmodel
Class EventRecordFactory

java.lang.Object
  extended by org.apache.poi.hssf.eventmodel.EventRecordFactory

public class EventRecordFactory
extends java.lang.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
EventRecordFactory()
          Construct an abortable EventRecordFactory.
EventRecordFactory(boolean abortable)
          Create an EventRecordFactory
 
Method Summary
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  java.util.Iterator listeners()
          used for unit tests to test the registration of record listeners.
 void processRecords(java.io.InputStream in)
          Create an array of records from an input stream
 void registerListener(ERFListener listener, short[] sids)
          Register a listener for records.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 java.util.Iterator listeners()
used for unit tests to test the registration of record listeners.

Returns:
Iterator of ERFListeners

processRecords

public void processRecords(java.io.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


Copyright 2008 The Apache Software Foundation or its licensors, as applicable.