org.apache.poi.poifs.filesystem
Class DocumentFactoryHelper
java.lang.Object
org.apache.poi.poifs.filesystem.DocumentFactoryHelper
public class DocumentFactoryHelper
- extends java.lang.Object
A small base class for the various factories, e.g. WorkbookFactory,
SlideShowFactory to combine common code here.
Method Summary |
static java.io.InputStream |
getDecryptedStream(NPOIFSFileSystem fs,
java.lang.String password)
Wrap the OLE2 data in the NPOIFSFileSystem into a decrypted stream by using
the given password. |
static boolean |
hasOOXMLHeader(java.io.InputStream inp)
Checks that the supplied InputStream (which MUST
support mark and reset, or be a PushbackInputStream)
has a OOXML (zip) header at the start of it. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DocumentFactoryHelper
public DocumentFactoryHelper()
getDecryptedStream
public static java.io.InputStream getDecryptedStream(NPOIFSFileSystem fs,
java.lang.String password)
throws java.io.IOException
- Wrap the OLE2 data in the NPOIFSFileSystem into a decrypted stream by using
the given password.
- Parameters:
fs
- The OLE2 stream for the documentpassword
- The password, null if the default password should be used
- Returns:
- A stream for reading the decrypted data
- Throws:
java.io.IOException
- If an error occurs while decrypting or if the password does not match
hasOOXMLHeader
public static boolean hasOOXMLHeader(java.io.InputStream inp)
throws java.io.IOException
- Checks that the supplied InputStream (which MUST
support mark and reset, or be a PushbackInputStream)
has a OOXML (zip) header at the start of it.
If your InputStream does not support mark / reset,
then wrap it in a PushBackInputStream, then be
sure to always use that, and not the original!
- Parameters:
inp
- An InputStream which supports either mark/reset, or is a PushbackInputStream
- Throws:
java.io.IOException
Copyright 2016 The Apache Software Foundation or
its licensors, as applicable.