static InputStream getPOIFSInputStream(POIFSFileSystem fs) throws IOException { String workbookName = HSSFWorkbook.getWorkbookDirEntryName(fs.getRoot()); return fs.createDocumentInputStream(workbookName); }
/** * Write out this workbook to the currently open {@link File} via the * writeable {@link POIFSFileSystem} it was opened as. * * <p>This will fail (with an {@link IllegalStateException} if the * Workbook was opened read-only, opened from an {@link InputStream} * instead of a File, or if this is not the root document. For those cases, * you must use {@link #write(OutputStream)} or {@link #write(File)} to * write to a brand new document. */ @Override public void write() throws IOException { validateInPlaceWritePossible(); final DirectoryNode dir = getDirectory(); // Update the Workbook stream in the file DocumentNode workbookNode = (DocumentNode)dir.getEntry( getWorkbookDirEntryName(dir)); POIFSDocument workbookDoc = new POIFSDocument(workbookNode); workbookDoc.replaceContents(new ByteArrayInputStream(getBytes())); // Update the properties streams in the file writeProperties(); // Sync with the File on disk dir.getFileSystem().writeFilesystem(); }
String workbookName = getWorkbookDirEntryName(directory);
static InputStream getPOIFSInputStream(POIFSFileSystem fs) throws IOException { String workbookName = HSSFWorkbook.getWorkbookDirEntryName(fs.getRoot()); return fs.createDocumentInputStream(workbookName); }
String workbookName = getWorkbookDirEntryName(directory);
/** * Write out this workbook to the currently open {@link File} via the * writeable {@link POIFSFileSystem} it was opened as. * * <p>This will fail (with an {@link IllegalStateException} if the * Workbook was opened read-only, opened from an {@link InputStream} * instead of a File, or if this is not the root document. For those cases, * you must use {@link #write(OutputStream)} or {@link #write(File)} to * write to a brand new document. */ @Override public void write() throws IOException { validateInPlaceWritePossible(); final DirectoryNode dir = getDirectory(); // Update the Workbook stream in the file DocumentNode workbookNode = (DocumentNode)dir.getEntry( getWorkbookDirEntryName(dir)); POIFSDocument workbookDoc = new POIFSDocument(workbookNode); workbookDoc.replaceContents(new ByteArrayInputStream(getBytes())); // Update the properties streams in the file writeProperties(); // Sync with the File on disk dir.getFileSystem().writeFilesystem(); }
String workbookName = getWorkbookDirEntryName(directory);
String workbookName = getWorkbookDirEntryName(directory);