use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class TestPOIFSDump method testFailToWrite.
@Test(expected = IndexOutOfBoundsException.class)
public void testFailToWrite() throws IOException {
File dir = TempFile.createTempFile("TestPOIFSDump", ".tst");
assertTrue("Had: " + dir, dir.exists());
assertTrue("Had: " + dir, dir.delete());
assertTrue("Had: " + dir, dir.mkdirs());
FileInputStream is = new FileInputStream(TEST_FILE);
NPOIFSFileSystem fs = new NPOIFSFileSystem(is);
is.close();
NPropertyTable props = fs.getPropertyTable();
assertNotNull(props);
// try with an invalid startBlock to trigger an exception
// to validate that file-handles are closed properly
POIFSDump.dump(fs, 999999999, "mini-stream", dir);
}
use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class HSSFWorkbook method write.
/**
* Method write - write out this workbook to an {@link OutputStream}. Constructs
* a new POI POIFSFileSystem, passes in the workbook binary representation and
* writes it out.
*
* If {@code stream} is a {@link java.io.FileOutputStream} on a networked drive
* or has a high cost/latency associated with each written byte,
* consider wrapping the OutputStream in a {@link java.io.BufferedOutputStream}
* to improve write performance.
*
* @param stream - the java OutputStream you wish to write the XLS to
*
* @exception IOException if anything can't be written.
* @see org.apache.poi.poifs.filesystem.POIFSFileSystem
*/
@Override
public void write(OutputStream stream) throws IOException {
NPOIFSFileSystem fs = new NPOIFSFileSystem();
try {
write(fs);
fs.writeFilesystem(stream);
} finally {
fs.close();
}
}
use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class HDGFDiagram method main.
/**
* For testing only
*/
public static void main(String[] args) throws Exception {
NPOIFSFileSystem pfs = new NPOIFSFileSystem(new File(args[0]));
HDGFDiagram hdgf = new HDGFDiagram(pfs);
hdgf.debug();
hdgf.close();
pfs.close();
}
use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem 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();
}
}
use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class HPBFDumper method main.
@SuppressWarnings("resource")
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Use:");
System.err.println(" HPBFDumper <filename>");
System.exit(1);
}
HPBFDumper dump = new HPBFDumper(new NPOIFSFileSystem(new File(args[0])));
System.out.println("Dumping " + args[0]);
dump.dumpContents();
dump.dumpEnvelope();
dump.dumpEscher();
dump.dump001CompObj(dump.fs.getRoot());
dump.dumpQuill();
// Still to go:
// (0x03)Internal
// Objects
}
Aggregations