Low level event based HSSF reader. Pass either a DocumentInputStream to
process events along with a request object or pass a POIFS POIFSFileSystem to
processWorkbookEvents along with a request.
This will cause your file to be processed a record at a time. Each record with
a static id matching one that you have registed in your HSSFRequest will be passed
to your associated HSSFListener.
| Method from org.apache.poi.hssf.eventusermodel.HSSFEventFactory Detail: |
public short abortableProcessEvents(HSSFRequest req,
InputStream in) throws IOException, HSSFUserException {
return genericProcessEvents(req, new RecordInputStream(in));
}
Processes a DocumentInputStream into essentially Record events. |
public short abortableProcessWorkbookEvents(HSSFRequest req,
POIFSFileSystem fs) throws IOException, HSSFUserException {
InputStream in = fs.createDocumentInputStream("Workbook");
return abortableProcessEvents(req, in);
}
Processes a file into essentially record events. |
protected short genericProcessEvents(HSSFRequest req,
RecordInputStream in) throws IOException, HSSFUserException {
boolean going = true;
short userCode = 0;
Record r = null;
// Create a new RecordStream and use that
HSSFRecordStream recordStream = new HSSFRecordStream(in);
// Process each record as they come in
while(going) {
r = recordStream.nextRecord();
if(r != null) {
userCode = req.processRecord(r);
if (userCode != 0) break;
} else {
going = false;
}
}
// All done, return our last code
return userCode;
}
Processes a DocumentInputStream into essentially Record events. |
public void processEvents(HSSFRequest req,
InputStream in) throws IOException {
try
{
genericProcessEvents(req, new RecordInputStream(in));
}
catch (HSSFUserException hue)
{/*If an HSSFUserException user exception is thrown, ignore it.*/ }
}
Processes a DocumentInputStream into essentially Record events.
If an AbortableHSSFListener causes a halt to processing during this call
the method will return just as with abortableProcessEvents, but no
user code or HSSFUserException will be passed back. |
public void processWorkbookEvents(HSSFRequest req,
POIFSFileSystem fs) throws IOException {
InputStream in = fs.createDocumentInputStream("Workbook");
processEvents(req, in);
}
Processes a file into essentially record events. |