Top Description Constructors Methods
org.apache.poi.poifs.filesystem

public final Class DocumentFactoryHelper

extends Object
Class Inheritance
Annotations
@Internal
Static Imports
org.apache.poi.extractor.ExtractorFactory.OOXML_PACKAGE

A small base class for the various factories, e.g. WorkbookFactory, SlideShowFactory to combine common code here.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static InputStream

Returns:

A stream for reading the decrypted data
getDecryptedStream
(final POIFSFileSystem
The OLE2 stream for the document
fs
,
String
The password, null if the default password should be used
password
)

Wrap the OLE2 data in the POIFSFileSystem into a decrypted stream by using the given password.

public static InputStream

Returns:

A stream for reading the decrypted data
getDecryptedStream
(final DirectoryNode
The OLE2 directory node for the document
root
,
String
The password, null if the default password should be used
password
)

Wrap the OLE2 data of the DirectoryNode into a decrypted stream by using the given password.

public static boolean
hasOOXMLHeader(InputStream
An InputStream which supports either mark/reset
inp
)
Deprecated in 3.17-beta2, use FileMagic#valueOf(InputStream) == FileMagic.OOXML instead

Checks that the supplied InputStream (which MUST support mark and reset) has a OOXML (zip) header at the start of it.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

DocumentFactoryHelperback to summary
private DocumentFactoryHelper()

Method Detail

getDecryptedStreamback to summary
public static InputStream getDecryptedStream(final POIFSFileSystem fs, String password) throws IOException

Wrap the OLE2 data in the POIFSFileSystem into a decrypted stream by using the given password.

Parameters
fs:POIFSFileSystem

The OLE2 stream for the document

password:String

The password, null if the default password should be used

Returns:InputStream

A stream for reading the decrypted data

Exceptions
IOException:
If an error occurs while decrypting or if the password does not match
getDecryptedStreamback to summary
public static InputStream getDecryptedStream(final DirectoryNode root, String password) throws IOException

Wrap the OLE2 data of the DirectoryNode into a decrypted stream by using the given password.

Parameters
root:DirectoryNode

The OLE2 directory node for the document

password:String

The password, null if the default password should be used

Returns:InputStream

A stream for reading the decrypted data

Exceptions
IOException:
If an error occurs while decrypting or if the password does not match
hasOOXMLHeaderback to summary
public static boolean hasOOXMLHeader(InputStream inp) throws IOException

Deprecated

in 3.17-beta2, use FileMagic#valueOf(InputStream) == FileMagic.OOXML instead

Checks 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:InputStream

An InputStream which supports either mark/reset

Annotations
@Deprecated
@Removal
version:4.0