use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class EFBiffViewer method run.
public void run() throws IOException {
NPOIFSFileSystem fs = new NPOIFSFileSystem(new File(file), true);
try {
InputStream din = BiffViewer.getPOIFSInputStream(fs);
try {
HSSFRequest req = new HSSFRequest();
req.addListenerForAllRecords(new HSSFListener() {
public void processRecord(Record rec) {
System.out.println(rec);
}
});
HSSFEventFactory factory = new HSSFEventFactory();
factory.processEvents(req, din);
} finally {
din.close();
}
} finally {
fs.close();
}
}
use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class HPSFPropertiesOnlyDocument method write.
/**
* Write out, with any properties changes, but nothing else
*/
public void write(OutputStream out) throws IOException {
NPOIFSFileSystem fs = new NPOIFSFileSystem();
try {
write(fs);
fs.writeFilesystem(out);
} finally {
fs.close();
}
}
use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class HPSFPropertiesOnlyDocument method write.
/**
* Write out to the currently open file the properties changes, but nothing else
*/
public void write() throws IOException {
NPOIFSFileSystem fs = getDirectory().getFileSystem();
validateInPlaceWritePossible();
writeProperties(fs, null);
fs.writeFilesystem();
}
use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class OutlookTextExtactor method main.
public static void main(String[] args) throws Exception {
for (String filename : args) {
NPOIFSFileSystem poifs = null;
OutlookTextExtactor extractor = null;
try {
poifs = new NPOIFSFileSystem(new File(filename));
extractor = new OutlookTextExtactor(poifs);
System.out.println(extractor.getText());
} finally {
if (extractor != null)
extractor.close();
if (poifs != null)
poifs.close();
}
}
}
use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class TestBugs method bug51461.
/**
* File with exactly 256 data blocks (+header block)
* shouldn't break on POIFS loading
*/
@SuppressWarnings("resource")
@Test
public void bug51461() throws Exception {
byte[] data = HSSFITestDataProvider.instance.getTestDataFileContent("51461.xls");
HSSFWorkbook wbPOIFS = new HSSFWorkbook(new POIFSFileSystem(new ByteArrayInputStream(data)).getRoot(), false);
HSSFWorkbook wbNPOIFS = new HSSFWorkbook(new NPOIFSFileSystem(new ByteArrayInputStream(data)).getRoot(), false);
assertEquals(2, wbPOIFS.getNumberOfSheets());
assertEquals(2, wbNPOIFS.getNumberOfSheets());
}
Aggregations