Methods Summary |
---|
public boolean | processRecord(org.apache.poi.hssf.record.Record rec)
if (rec.getSid() == BOFRecord.sid) {
if (lastEOF != true) {
throw new RuntimeException("Not yet handled embedded models");
} else {
BOFRecord bof = (BOFRecord)rec;
switch (bof.getType()) {
case BOFRecord.TYPE_WORKBOOK:
currentmodel = new Workbook();
break;
case BOFRecord.TYPE_WORKSHEET:
currentmodel = new Sheet();
break;
default:
throw new RuntimeException("Unsupported model type "+bof.getType());
}
}
}
if (rec.getSid() == EOFRecord.sid) {
lastEOF = true;
throwEvent(currentmodel);
} else {
lastEOF = false;
}
return true;
|
public void | registerListener(ModelFactoryListener listener)register a ModelFactoryListener so that it can receive
Models as they are created.
listeners.add(listener);
|
public void | run(java.io.InputStream stream)Start processing the Workbook stream into Model events.
EventRecordFactory factory = new EventRecordFactory(true);
factory.registerListener(this,null);
lastEOF = true;
factory.processRecords(stream);
|
private void | throwEvent(org.apache.poi.hssf.model.Model model)Throws the model as an event to the listeners
Iterator i = listeners.iterator();
while (i.hasNext()) {
ModelFactoryListener mfl = (ModelFactoryListener) i.next();
mfl.process(model);
}
|