Top Description Inners Fields Constructors Methods
org.apache.poi.hssf.record

public final Class RecordFactoryInputStream

extends Object
Class Inheritance
Imports
java.io.InputStream, java.security.GeneralSecurityException, java.util.ArrayList, .List, org.apache.poi.EncryptedDocumentException, org.apache.poi.hssf.eventusermodel.HSSFEventFactory, .HSSFListener, org.apache.poi.hssf.record.crypto.Biff8EncryptionKey, org.apache.poi.poifs.crypt.Decryptor, .EncryptionInfo, org.apache.poi.util.RecordFormatException

A stream based way to get at complete records, with as low a memory footprint as possible. This handles reading from a RecordInputStream, turning the data into full records, processing continue records etc. Most users should use HSSFEventFactory / HSSFListener and have new records pushed to them, but this does allow for a "pull" style of coding.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
RecordFactoryInputStream.StreamEncryptionInfo

Keeps track of the sizes of the initial records up to and including FilePassRecord Needed for protected files because each byte is encrypted with respect to its absolute position from the start of the stream.

Field Summary

Modifier and TypeField and Description
private int
private DrawingRecord
_lastDrawingRecord

The most recent DrawingRecord seen

private Record
_lastRecord

The most recent record that we gave to the user

private boolean
private final RecordInputStream
private final boolean
private Record[]
_unreadRecordBuffer

Temporarily stores a group of Records, for future return by nextRecord().

private int
_unreadRecordIndex

used to help iterating over the unread records

Constructor Summary

AccessConstructor and Description
public
RecordFactoryInputStream(InputStream
the InputStream to read from
in
,
boolean
caller can pass false if loose ContinueRecords should be skipped (this is sometimes useful in event based processing).
shouldIncludeContinueRecords
)

Method Summary

Modifier and TypeMethod and Description
private Record

Returns:

the next Record from the multiple record group as expanded from a recently read MulRKRecord. null if not present.
getNextUnreadRecord
()

public Record

Returns:

the next (complete) record from the stream, or null if there are no more.
nextRecord
()

private Record

Returns:

the next available record, or null if this pass didn't return a record that's suitable for returning (eg was a continue record).
readNextRecord
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_bofDepthback to summary
private int _bofDepth
_lastDrawingRecordback to summary
private DrawingRecord _lastDrawingRecord

The most recent DrawingRecord seen

_lastRecordback to summary
private Record _lastRecord

The most recent record that we gave to the user

_lastRecordWasEOFLevelZeroback to summary
private boolean _lastRecordWasEOFLevelZero
_recStreamback to summary
private final RecordInputStream _recStream
_shouldIncludeContinueRecordsback to summary
private final boolean _shouldIncludeContinueRecords
_unreadRecordBufferback to summary
private Record[] _unreadRecordBuffer

Temporarily stores a group of Records, for future return by nextRecord(). This is used at the start of the workbook stream, and also when the most recently read underlying record is a MulRKRecord

_unreadRecordIndexback to summary
private int _unreadRecordIndex

used to help iterating over the unread records

Constructor Detail

RecordFactoryInputStreamback to summary
public RecordFactoryInputStream(InputStream in, boolean shouldIncludeContinueRecords)
Parameters
in:InputStream

the InputStream to read from

shouldIncludeContinueRecords:boolean

caller can pass false if loose ContinueRecords should be skipped (this is sometimes useful in event based processing).

Method Detail

getNextUnreadRecordback to summary
private Record getNextUnreadRecord()
Returns:Record

the next Record from the multiple record group as expanded from a recently read MulRKRecord. null if not present.

nextRecordback to summary
public Record nextRecord()
Returns:Record

the next (complete) record from the stream, or null if there are no more.

readNextRecordback to summary
private Record readNextRecord()
Returns:Record

the next available record, or null if this pass didn't return a record that's suitable for returning (eg was a continue record).

org.apache.poi.hssf.record back to summary

private final Class RecordFactoryInputStream.StreamEncryptionInfo

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.poi.hssf.record.RecordFactoryInputStream.StreamEncryptionInfo

Keeps track of the sizes of the initial records up to and including FilePassRecord Needed for protected files because each byte is encrypted with respect to its absolute position from the start of the stream.

Field Summary

Modifier and TypeField and Description
private final FilePassRecord
private final boolean
private final int
private final Record

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public RecordInputStream
public Record

Returns:

last record scanned while looking for encryption info. This will typically be the first or second record read. Possibly null if stream was empty
getLastRecord
()

public boolean
hasBOFRecord()

false in some test cases

public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_filePassRecback to summary
private final FilePassRecord _filePassRec
_hasBOFRecordback to summary
private final boolean _hasBOFRecord
_initialRecordsSizeback to summary
private final int _initialRecordsSize
_lastRecordback to summary
private final Record _lastRecord

Constructor Detail

StreamEncryptionInfoback to summary
public StreamEncryptionInfo(RecordInputStream rs, List<Record> outputRecs)

Method Detail

createDecryptingStreamback to summary
public RecordInputStream createDecryptingStream(InputStream original)
Annotations
@SuppressWarnings:squid:S2068
getLastRecordback to summary
public Record getLastRecord()
Returns:Record

last record scanned while looking for encryption info. This will typically be the first or second record read. Possibly null if stream was empty

hasBOFRecordback to summary
public boolean hasBOFRecord()

false in some test cases

hasEncryptionback to summary
public boolean hasEncryption()