public class POIFSFileSystem extends NPOIFSFileSystem implements POIFSViewable
POIFSFileSystem to
OPOIFSFileSystem, and from NPOIFSFileSystem to
POIFSFileSystem. Currently, this is OPOIFS-poweredBlockStore.ChainLoopDetector| Constructor and Description |
|---|
POIFSFileSystem()
Constructor, intended for writing
|
POIFSFileSystem(InputStream stream)
Create a POIFSFileSystem from an InputStream.
|
| Modifier and Type | Method and Description |
|---|---|
static InputStream |
createNonClosingInputStream(InputStream is)
Convenience method for clients that want to avoid the auto-close behaviour of the constructor.
|
static boolean |
hasPOIFSHeader(byte[] header8Bytes)
Checks if the supplied first 8 bytes of a stream / file
has a POIFS (OLE2) header.
|
static boolean |
hasPOIFSHeader(InputStream inp)
Checks that the supplied InputStream (which MUST
support mark and reset, or be a PushbackInputStream)
has a POIFS (OLE2) header at the start of it.
|
static void |
main(String[] args)
read in a file and write it back out again
|
close, createBlockIfNeeded, createDirectory, createDocument, createDocument, createDocumentInputStream, getBATBlockAndIndex, getBigBlockSize, getBigBlockSizeDetails, getBlockAt, getBlockStoreBlockSize, getChainLoopDetector, getFreeBlock, getMiniStore, getNextBlock, getRoot, getShortDescription, getViewableArray, getViewableIterator, preferArray, setNextBlock, size, writeFilesystem, writeFilesystemclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetShortDescription, getViewableArray, getViewableIterator, preferArraypublic POIFSFileSystem()
public POIFSFileSystem(InputStream stream) throws IOException
true
for markSupported()). In the unlikely case that the caller has such a stream
and needs to use it after this constructor completes, a work around is to wrap the
stream in order to trap the close() call. A convenience method (
createNonClosingInputStream()) has been provided for this purpose:
InputStream wrappedStream = POIFSFileSystem.createNonClosingInputStream(is); HSSFWorkbook wb = new HSSFWorkbook(wrappedStream); is.reset(); doSomethingElse(is);Note also the special case of ByteArrayInputStream for which the close() method does nothing.
ByteArrayInputStream bais = ... HSSFWorkbook wb = new HSSFWorkbook(bais); // calls bais.close() ! bais.reset(); // no problem doSomethingElse(bais);
stream - the InputStream from which to read the dataIOException - on errors reading, or on invalid datapublic static InputStream createNonClosingInputStream(InputStream is)
public static boolean hasPOIFSHeader(InputStream inp) throws IOException
inp - An InputStream which supports either mark/reset, or is a PushbackInputStreamIOExceptionpublic static boolean hasPOIFSHeader(byte[] header8Bytes)
public static void main(String[] args) throws IOException
args - names of the files; arg[ 0 ] is the input file,
arg[ 1 ] is the output fileIOExceptionCopyright © 2007-2020. All Rights Reserved.