org.apache.poi.poifs.eventfilesystem

## Class POIFSReader

- java.lang.Object
- - org.apache.poi.poifs.eventfilesystem.POIFSReader

-     public class POIFSReader
      extends java.lang.Object

  An event-driven reader for POIFS file systems. Users of this class first create an instance of it, then use the registerListener methods to register POIFSReaderListener instances for specific documents. Once all the listeners have been registered, the read() method is called, which results in the listeners being notified as their documents are read.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `POIFSReader()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### POIFSReader

          public POIFSReader()

  - ### Method Detail

    - #### read

          public void read(java.io.InputStream stream)
                    throws java.io.IOException

      Read from an InputStream and process the documents we get
      Parameters:
        `stream` - the InputStream from which to read the data
      Throws:
        `java.io.IOException` - on errors reading, or on invalid data

    - #### read

          public void read(java.io.File poifsFile)
                    throws java.io.IOException

      Read from a File and process the documents we get
      Parameters:
        `poifsFile` - the file from which to read the data
      Throws:
        `java.io.IOException` - on errors reading, or on invalid data

    - #### read

          public void read(POIFSFileSystem poifs)
                    throws java.io.IOException

      Read from a `POIFSFileSystem` and process the documents we get
      Parameters:
        `poifs` - the POIFSFileSystem from which to read the data
      Throws:
        `java.io.IOException` - on errors reading, or on invalid data

    - #### registerListener

          public void registerListener(POIFSReaderListener listener)

      Register a POIFSReaderListener for all documents
      Parameters:
        `listener` - the listener to be registered
      Throws:
        `java.lang.NullPointerException` - if listener is null
        `java.lang.IllegalStateException` - if read() has already been called

    - #### registerListener

          public void registerListener(POIFSReaderListener listener,
                                       java.lang.String name)

      Register a POIFSReaderListener for a document in the root directory
      Parameters:
        `listener` - the listener to be registered
        `name` - the document name
      Throws:
        `java.lang.NullPointerException` - if listener is null or name is null or empty
        `java.lang.IllegalStateException` - if read() has already been called

    - #### registerListener

          public void registerListener(POIFSReaderListener listener,
                                       POIFSDocumentPath path,
                                       java.lang.String name)

      Register a POIFSReaderListener for a document in the specified directory
      Parameters:
        `listener` - the listener to be registered
        `path` - the document path; if null, the root directory is assumed
        `name` - the document name
      Throws:
        `java.lang.NullPointerException` - if listener is null or name is null or empty
        `java.lang.IllegalStateException` - if read() has already been called

    - #### setNotifyEmptyDirectories

          public void setNotifyEmptyDirectories(boolean notifyEmptyDirectories)

      Activates the notification of empty directories.

      If this flag is activated, the `listener` receives `POIFSReaderEvents` with nulled `name` and `stream`

      Parameters:
        `notifyEmptyDirectories` - if `true`, empty directories will be notified

    - #### main

          public static void main(java.lang.String[] args)
                           throws java.io.IOException

      read in files
      Parameters:
        `args` - names of the files
      Throws:
        `java.io.IOException` - if the files can't be read or have invalid content

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.