use of org.apache.poi.poifs.property.NPropertyTable in project poi by apache.
the class TestNPOIFSFileSystem method readZeroLengthEntries.
@Test
public void readZeroLengthEntries() throws IOException {
NPOIFSFileSystem fs = new NPOIFSFileSystem(_inst.getFile("only-zero-byte-streams.ole2"));
DirectoryNode testDir = fs.getRoot();
assertEquals(3, testDir.getEntryCount());
DocumentEntry entry;
entry = (DocumentEntry) testDir.getEntry("test-zero-1");
assertNotNull(entry);
assertEquals(0, entry.getSize());
entry = (DocumentEntry) testDir.getEntry("test-zero-2");
assertNotNull(entry);
assertEquals(0, entry.getSize());
entry = (DocumentEntry) testDir.getEntry("test-zero-3");
assertNotNull(entry);
assertEquals(0, entry.getSize());
// Check properties, all have zero length, no blocks
NPropertyTable props = fs._get_property_table();
assertEquals(POIFSConstants.END_OF_CHAIN, props.getRoot().getStartBlock());
for (Property prop : props.getRoot()) {
assertEquals("test-zero-", prop.getName().substring(0, 10));
assertEquals(POIFSConstants.END_OF_CHAIN, prop.getStartBlock());
}
// All done
fs.close();
}
Aggregations