public class POIFSReader
extends java.lang.Object
Constructor and Description |
---|
POIFSReader() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
read in files
|
void |
read(java.io.File poifsFile)
Read from a File and process the documents we get
|
void |
read(java.io.InputStream stream)
Read from an InputStream and process the documents we get
|
void |
read(POIFSFileSystem poifs)
Read from a
POIFSFileSystem and process the documents we get |
void |
registerListener(POIFSReaderListener listener)
Register a POIFSReaderListener for all documents
|
void |
registerListener(POIFSReaderListener listener,
POIFSDocumentPath path,
java.lang.String name)
Register a POIFSReaderListener for a document in the specified
directory
|
void |
registerListener(POIFSReaderListener listener,
java.lang.String name)
Register a POIFSReaderListener for a document in the root
directory
|
void |
setNotifyEmptyDirectories(boolean notifyEmptyDirectories)
Activates the notification of empty directories.
|
public void read(java.io.InputStream stream) throws java.io.IOException
stream
- the InputStream from which to read the datajava.io.IOException
- on errors reading, or on invalid datapublic void read(java.io.File poifsFile) throws java.io.IOException
poifsFile
- the file from which to read the datajava.io.IOException
- on errors reading, or on invalid datapublic void read(POIFSFileSystem poifs) throws java.io.IOException
POIFSFileSystem
and process the documents we getpoifs
- the POIFSFileSystem from which to read the datajava.io.IOException
- on errors reading, or on invalid datapublic void registerListener(POIFSReaderListener listener)
listener
- the listener to be registeredjava.lang.NullPointerException
- if listener is nulljava.lang.IllegalStateException
- if read() has already been
calledpublic void registerListener(POIFSReaderListener listener, java.lang.String name)
listener
- the listener to be registeredname
- the document namejava.lang.NullPointerException
- if listener is null or name is
null or emptyjava.lang.IllegalStateException
- if read() has already been
calledpublic void registerListener(POIFSReaderListener listener, POIFSDocumentPath path, java.lang.String name)
listener
- the listener to be registeredpath
- the document path; if null, the root directory is
assumedname
- the document namejava.lang.NullPointerException
- if listener is null or name is
null or emptyjava.lang.IllegalStateException
- if read() has already been
calledpublic void setNotifyEmptyDirectories(boolean notifyEmptyDirectories)
If this flag is activated, the listener
receives
POIFSReaderEvents
with nulled name
and stream
notifyEmptyDirectories
- if true
, empty directories will be notifiedpublic static void main(java.lang.String[] args) throws java.io.IOException
args
- names of the filesjava.io.IOException
- if the files can't be read or have invalid contentCopyright 2022 The Apache Software Foundation or its licensors, as applicable.