use of org.apache.poi.hdgf.HDGFDiagram 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);
}
use of org.apache.poi.hdgf.HDGFDiagram in project poi by apache.
the class TestVisioExtractor method testCreation.
/**
* Test the 3 different ways of creating one
*/
@Test
public void testCreation() throws IOException {
VisioTextExtractor extractor1 = openExtractor(defFilename);
assertNotNull(extractor1);
assertNotNull(extractor1.getAllText());
assertEquals(defTextChunks, extractor1.getAllText().length);
extractor1.close();
InputStream is2 = _dgTests.openResourceAsStream(defFilename);
POIFSFileSystem poifs2 = new POIFSFileSystem(is2);
is2.close();
VisioTextExtractor extractor2 = new VisioTextExtractor(poifs2);
assertNotNull(extractor2);
assertNotNull(extractor2.getAllText());
assertEquals(defTextChunks, extractor2.getAllText().length);
extractor2.close();
poifs2.close();
InputStream is3 = _dgTests.openResourceAsStream(defFilename);
POIFSFileSystem poifs3 = new POIFSFileSystem(is3);
is3.close();
HDGFDiagram hdgf3 = new HDGFDiagram(poifs3);
VisioTextExtractor extractor3 = new VisioTextExtractor(hdgf3);
assertNotNull(extractor3);
assertNotNull(extractor3.getAllText());
assertEquals(defTextChunks, extractor3.getAllText().length);
extractor3.close();
hdgf3.close();
poifs3.close();
}
use of org.apache.poi.hdgf.HDGFDiagram in project poi by apache.
the class VSDDumper method main.
public static void main(String[] args) throws Exception {
if (args.length == 0) {
System.err.println("Use:");
System.err.println(" VSDDumper <filename>");
System.exit(1);
}
NPOIFSFileSystem poifs = new NPOIFSFileSystem(new File(args[0]));
try {
HDGFDiagram hdgf = new HDGFDiagram(poifs);
PrintStream ps = System.out;
ps.println("Opened " + args[0]);
VSDDumper vd = new VSDDumper(ps, hdgf);
vd.dumpFile();
} finally {
poifs.close();
}
}
Aggregations