use of org.apache.poi.hdgf.streams.TrailerStream in project poi by apache.
the class TestHDGFCore method testTrailer.
public void testTrailer() throws Exception {
hdgf = new HDGFDiagram(fs);
assertNotNull(hdgf);
assertNotNull(hdgf.getTrailerStream());
// Check it has what we'd expect
TrailerStream trailer = hdgf.getTrailerStream();
assertEquals(0x8a94, trailer.getPointer().getOffset());
assertNotNull(trailer.getPointedToStreams());
assertEquals(20, trailer.getPointedToStreams().length);
assertEquals(20, hdgf.getTopLevelStreams().length);
// 9th one should have children
assertNotNull(trailer.getPointedToStreams()[8]);
assertNotNull(trailer.getPointedToStreams()[8].getPointer());
PointerContainingStream ps8 = (PointerContainingStream) trailer.getPointedToStreams()[8];
assertNotNull(ps8.getPointedToStreams());
assertEquals(8, ps8.getPointedToStreams().length);
}
use of org.apache.poi.hdgf.streams.TrailerStream in project poi by apache.
the class HDGFFileHandler method handleFile.
@Override
public void handleFile(InputStream stream, String path) throws IOException {
POIFSFileSystem poifs = new POIFSFileSystem(stream);
HDGFDiagram diagram = new HDGFDiagram(poifs);
Stream[] topLevelStreams = diagram.getTopLevelStreams();
assertNotNull(topLevelStreams);
for (Stream str : topLevelStreams) {
assertTrue(str.getPointer().getLength() >= 0);
}
TrailerStream trailerStream = diagram.getTrailerStream();
assertNotNull(trailerStream);
assertTrue(trailerStream.getPointer().getLength() >= 0);
diagram.close();
poifs.close();
// writing is not yet implemented... handlePOIDocument(diagram);
}
Aggregations