use of org.apache.poi.hssf.record.RecordInputStream in project poi by apache.
the class TestPageItemRecord method testMoreThanOneInfoItem_bug46917.
public void testMoreThanOneInfoItem_bug46917() {
byte[] data = HexRead.readFromString("01 02 03 04 05 06 07 08 09 0A 0B 0C");
RecordInputStream in = TestcaseRecordInputStream.create(PageItemRecord.sid, data);
PageItemRecord rec = new PageItemRecord(in);
if (in.remaining() == 6) {
throw new AssertionFailedError("Identified bug 46917");
}
assertEquals(0, in.remaining());
assertEquals(4 + data.length, rec.getRecordSize());
}
use of org.apache.poi.hssf.record.RecordInputStream in project poi by apache.
the class TestViewFieldsRecord method confirmSerialize.
private static ViewFieldsRecord confirmSerialize(String hexDump) {
byte[] data = HexRead.readFromString(hexDump);
RecordInputStream in = TestcaseRecordInputStream.create(ViewFieldsRecord.sid, data);
ViewFieldsRecord rec = new ViewFieldsRecord(in);
assertEquals(0, in.remaining());
assertEquals(4 + data.length, rec.getRecordSize());
byte[] data2 = rec.serialize();
TestcaseRecordInputStream.confirmRecordEncoding(ViewFieldsRecord.sid, data, data2);
return rec;
}
use of org.apache.poi.hssf.record.RecordInputStream in project poi by apache.
the class OldExcelExtractor method open.
private void open(DirectoryNode directory) throws IOException {
DocumentNode book;
try {
book = (DocumentNode) directory.getEntry(OLD_WORKBOOK_DIR_ENTRY_NAME);
} catch (FileNotFoundException e) {
// some files have "Workbook" instead
book = (DocumentNode) directory.getEntry(WORKBOOK_DIR_ENTRY_NAMES[0]);
}
if (book == null) {
throw new IOException("No Excel 5/95 Book stream found");
}
ris = new RecordInputStream(directory.createDocumentInputStream(book));
prepare();
}
Aggregations