Class POIFSReader


  • public class POIFSReader
    extends 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.
    Author:
    Marc Johnson (mjohnson at apache dot org)
    • Constructor Detail

      • POIFSReader

        public POIFSReader()
        Create a POIFSReader
    • Method Detail

      • read

        public void read​(loci.common.RandomAccessInputStream stream,
                         int size)
                  throws IOException
        Read from an InputStream and process the documents we get
        Parameters:
        stream - the InputStream from which to read the data
        Throws:
        IOException - on errors reading, or on invalid data
      • registerListener

        public void registerListener​(POIFSReaderListener listener,
                                     String name)
        Register a POIFSReaderListener for a document in the root directory
        Parameters:
        listener - the listener to be registered
        name - the document name
        Throws:
        NullPointerException - if listener is null or name is null or empty
        IllegalStateException - if read() has already been called
      • registerListener

        public void registerListener​(POIFSReaderListener listener,
                                     POIFSDocumentPath path,
                                     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:
        NullPointerException - if listener is null or name is null or empty
        IllegalStateException - if read() has already been called
      • main

        public static void main​(String[] args)
                         throws IOException
        read in files
        Parameters:
        args - names of the files
        Throws:
        IOException