Package org.apache.poi.poifs.filesystem
Class DocumentFactoryHelper
- java.lang.Object
 - 
- org.apache.poi.poifs.filesystem.DocumentFactoryHelper
 
 
- 
@Internal public final 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
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.io.InputStreamgetDecryptedStream(DirectoryNode root, java.lang.String password)Wrap the OLE2 data of the DirectoryNode into a decrypted stream by using the given password.static java.io.InputStreamgetDecryptedStream(POIFSFileSystem fs, java.lang.String password)Wrap the OLE2 data in the NPOIFSFileSystem into a decrypted stream by using the given password.static booleanhasOOXMLHeader(java.io.InputStream inp)Deprecated.in 3.17-beta2, useFileMagic.valueOf(InputStream)== FileMagic.OOXML instead 
 - 
 
- 
- 
Method Detail
- 
getDecryptedStream
public static java.io.InputStream getDecryptedStream(POIFSFileSystem 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
 
- 
getDecryptedStream
public static java.io.InputStream getDecryptedStream(DirectoryNode root, java.lang.String password) throws java.io.IOException
Wrap the OLE2 data of the DirectoryNode into a decrypted stream by using the given password.- Parameters:
 root- The OLE2 directory node 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
@Deprecated @Removal(version="4.0") public static boolean hasOOXMLHeader(java.io.InputStream inp) throws java.io.IOException
Deprecated.in 3.17-beta2, useFileMagic.valueOf(InputStream)== FileMagic.OOXML insteadChecks that the supplied InputStream (which MUST support mark and reset) has a OOXML (zip) header at the start of it.If unsure if your InputStream does support mark / reset, use
FileMagic.prepareToCheckMagic(InputStream)to wrap it and make sure to always use that, and not the original!- Parameters:
 inp- An InputStream which supports either mark/reset- Throws:
 java.io.IOException
 
 - 
 
 -