Top Description Fields Constructors Methods
org.apache.poi.hssf.eventmodel

public final Class EventRecordFactory

extends Object
Class Inheritance
Imports
java.io.InputStream, java.util.Arrays, org.apache.poi.hssf.record.ContinueRecord, .Record, .RecordFactory, .RecordInputStream, org.apache.poi.util.RecordFormatException

Event-based record factory. As opposed to RecordFactory this version sends ERFListener#processRecord(org.apache.poi.hssf.record.Record) messages to the supplied listener. Record notifications are sent one record behind to ensure that ContinueRecords are processed first.

Field Summary

Modifier and TypeField and Description
private final ERFListener
private final short[]

Constructor Summary

AccessConstructor and Description
public
EventRecordFactory(ERFListener
the listener to be informed about events
listener
,
short[]
an array of Record.sid values identifying the records the listener will work with. Alternatively if this is "null" then all records are passed. For all 'known' record types use RecordFactory#getAllKnownRecordSIDs()
sids
)

Create an EventRecordFactory

Method Summary

Modifier and TypeMethod and Description
private boolean
isSidIncluded(short sid)

private boolean

Returns:

false to abort. This aborts out of the event loop should the listener return false
processRecord
(Record
the record to be thrown.
record
)

sends the record event to all registered listeners.

public void
processRecords(InputStream
the InputStream from which the records will be obtained
in
)

Create an array of records from an input stream

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_listenerback to summary
private final ERFListener _listener
_sidsback to summary
private final short[] _sids

Constructor Detail

EventRecordFactoryback to summary
public EventRecordFactory(ERFListener listener, short[] sids)

Create an EventRecordFactory

Parameters
listener:ERFListener

the listener to be informed about events

sids:short[]

an array of Record.sid values identifying the records the listener will work with. Alternatively if this is "null" then all records are passed. For all 'known' record types use RecordFactory#getAllKnownRecordSIDs()

Method Detail

isSidIncludedback to summary
private boolean isSidIncluded(short sid)
processRecordback to summary
private boolean processRecord(Record record)

sends the record event to all registered listeners.

Parameters
record:Record

the record to be thrown.

Returns:boolean

false to abort. This aborts out of the event loop should the listener return false

processRecordsback to summary
public void processRecords(InputStream in) throws RecordFormatException

Create an array of records from an input stream

Parameters
in:InputStream

the InputStream from which the records will be obtained

Exceptions
RecordFormatException:
on error processing the InputStream