Exemple #1
0
        /**
         * Reads a Set of files from a POI filesystem and returns them
         * as an array of {@link POIFile} instances. This method loads all
         * files into memory and thus does not cope well with large POI
         * filessystems.
         *
         * @param poiFs The name of the POI filesystem as seen by the
         * operating system. (This is the "filename".)
         *
         * @param poiFiles The names of the POI files to be Read.
         *
         * @return The POI files. The elements are ordered in the same way
         * as the files in the POI filesystem.
         *
         * @exception FileNotFoundException if the file containing the POI
         * filesystem does not exist
         *
         * @exception IOException if an I/O exception occurs
         */
        public static POIFile[] ReadPOIFiles(Stream poiFs,
                                             String[] poiFiles)
        {
            files = new ArrayList();
            POIFSReader reader1 = new POIFSReader();
            //reader1.StreamReaded += new POIFSReaderEventHandler(reader1_StreamReaded);
            POIFSReaderListener pfl = new POIFSReaderListener0();

            if (poiFiles == null)
            {
                /* Register the listener for all POI files. */
                reader1.RegisterListener(pfl);
            }
            else
            {
                /* Register the listener for the specified POI files
                 * only. */
                for (int i = 0; i < poiFiles.Length; i++)
                {
                    reader1.RegisterListener(pfl, poiFiles[i]);
                }
            }

            /* Read the POI filesystem. */
            reader1.Read(poiFs);
            POIFile[] result = new POIFile[files.Count];
            for (int i = 0; i < result.Length; i++)
            {
                result[i] = (POIFile)files[i];
            }
            return(result);
        }
Exemple #2
0
        /**
         * Reads a Set of files from a POI filesystem and returns them
         * as an array of {@link POIFile} instances. This method loads all
         * files into memory and thus does not cope well with large POI
         * filessystems.
         * 
         * @param poiFs The name of the POI filesystem as seen by the
         * operating system. (This is the "filename".)
         *
         * @param poiFiles The names of the POI files to be Read.
         *
         * @return The POI files. The elements are ordered in the same way
         * as the files in the POI filesystem.
         * 
         * @exception FileNotFoundException if the file containing the POI 
         * filesystem does not exist
         * 
         * @exception IOException if an I/O exception occurs
         */
        public static POIFile[] ReadPOIFiles(Stream poiFs,
                                             String[] poiFiles)
        {
            files = new ArrayList();
            POIFSReader reader1 = new POIFSReader();
            //reader1.StreamReaded += new POIFSReaderEventHandler(reader1_StreamReaded);
            POIFSReaderListener pfl = new POIFSReaderListener0();
            if (poiFiles == null)
                /* Register the listener for all POI files. */
                reader1.RegisterListener(pfl);
            else
                /* Register the listener for the specified POI files
                 * only. */
                for (int i = 0; i < poiFiles.Length; i++)
                    reader1.RegisterListener(pfl, poiFiles[i]);

            /* Read the POI filesystem. */
            reader1.Read(poiFs);
            POIFile[] result = new POIFile[files.Count];
            for (int i = 0; i < result.Length; i++)
                result[i] = (POIFile)files[i];
            return result;
        }