/** * read in files * * @param args names of the files * * @exception IOException if the files can't be read or have invalid content */ public static void main(String args[]) throws IOException { if (args.length == 0) { System.err.println("at least one argument required: input filename(s)"); System.exit(1); } // register for all for (String arg : args) { POIFSReader reader = new POIFSReader(); reader.registerListener(POIFSReader::readEntry); System.out.println("reading " + arg); reader.read(new File(arg)); } }
/** * Read from a NPOIFSFileSystem and process the documents we get * * @param poifs the NPOIFSFileSystem from which to read the data * * @exception IOException on errors reading, or on invalid data */ public void read(final POIFSFileSystem poifs) throws IOException { registryClosed = true; // get property table from the document PropertyTable properties = poifs.getPropertyTable(); // process documents RootProperty root = properties.getRoot(); processProperties(poifs, root, new POIFSDocumentPath()); }
final POIFSReader r = new POIFSReader(); final CopyFile cf = new CopyFile(copyFileName); r.registerListener(cf); r.setNotifyEmptyDirectories(true); r.read(new File(originalFileName));
final POIFSReader poiFSReader = new POIFSReader(); poiFSReader.registerListener(readerListener, SummaryInformation.DEFAULT_STREAM_NAME); SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
/** * Read from a File and process the documents we get * * @param poifsFile the file from which to read the data * * @exception IOException on errors reading, or on invalid data */ public void read(final File poifsFile) throws IOException { try (POIFSFileSystem poifs = new POIFSFileSystem(poifsFile, true)) { read(poifs); } }
/** * Register a POIFSReaderListener for a document in the root * directory * * @param listener the listener to be registered * @param name the document name * * @exception NullPointerException if listener is null or name is * null or empty * @exception IllegalStateException if read() has already been * called */ public void registerListener(final POIFSReaderListener listener, final String name) { registerListener(listener, null, name); }
/** * Read from an InputStream and process the documents we get * * @param stream the InputStream from which to read the data * * @exception IOException on errors reading, or on invalid data */ public void read(final InputStream stream) throws IOException { try (POIFSFileSystem poifs = new POIFSFileSystem(stream)) { read(poifs); } }
/** * Register a POIFSReaderListener for a document in the root * directory * * @param listener the listener to be registered * @param name the document name * * @exception NullPointerException if listener is null or name is * null or empty * @exception IllegalStateException if read() has already been * called */ public void registerListener(final POIFSReaderListener listener, final String name) { registerListener(listener, null, name); }
POIFSReader r = new POIFSReader(); r.registerListener(new MyPOIFSReaderListener(), "\005SummaryInformation"); r.read(new FileInputStream(filename));
public Void run() throws Exception { poiFSReader.read(is); return null; } });
/** * Register a POIFSReaderListener for a document in the root * directory * * @param listener the listener to be registered * @param name the document name * * @exception NullPointerException if listener is null or name is * null or empty * @exception IllegalStateException if read() has already been * called */ public void registerListener(final POIFSReaderListener listener, final String name) { registerListener(listener, null, name); }
processProperties(poifs, (DirectoryProperty) property, new_path); } else { POIFSDocument document = null;
public static MSOfficeMetadata instance( InputStream stream ) throws Exception { POIFSReader r = new POIFSReader(); MSOfficeMetadata MSOfficeMetadataListener = new MSOfficeMetadata(); r.registerListener(MSOfficeMetadataListener, "\005SummaryInformation"); r.read(stream); return MSOfficeMetadataListener; } }
/** * Read from an InputStream and process the documents we get * * @param stream the InputStream from which to read the data * * @exception IOException on errors reading, or on invalid data */ public void read(final InputStream stream) throws IOException { try (POIFSFileSystem poifs = new POIFSFileSystem(stream)) { read(poifs); } }
/** * Register a POIFSReaderListener for a document in the root * directory * * @param listener the listener to be registered * @param name the document name * * @exception NullPointerException if listener is null or name is * null or empty * @exception IllegalStateException if read() has already been * called */ public void registerListener(final POIFSReaderListener listener, final String name) { registerListener(listener, null, name); }
/** * Read from a NPOIFSFileSystem and process the documents we get * * @param poifs the NPOIFSFileSystem from which to read the data * * @exception IOException on errors reading, or on invalid data */ public void read(final POIFSFileSystem poifs) throws IOException { registryClosed = true; // get property table from the document PropertyTable properties = poifs.getPropertyTable(); // process documents RootProperty root = properties.getRoot(); processProperties(poifs, root, new POIFSDocumentPath()); }
public static MSOfficeMetadata instance( InputStream stream ) throws Exception { POIFSReader r = new POIFSReader(); MSOfficeMetadata MSOfficeMetadataListener = new MSOfficeMetadata(); r.registerListener(MSOfficeMetadataListener, "\005SummaryInformation"); r.read(stream); return MSOfficeMetadataListener; } }
/** * Read from a File and process the documents we get * * @param poifsFile the file from which to read the data * * @exception IOException on errors reading, or on invalid data */ public void read(final File poifsFile) throws IOException { try (POIFSFileSystem poifs = new POIFSFileSystem(poifsFile, true)) { read(poifs); } }
}); processProperties( small_blocks, big_blocks, (( DirectoryProperty ) property).getChildren(), new_path);
/** * <p>Runs the example program.</p> * * @param args Command-line arguments. The first command-line argument must * be the name of a POI filesystem to read. * @throws IOException if any I/O exception occurs. */ public static void main(final String[] args) throws IOException { final String filename = args[0]; POIFSReader r = new POIFSReader(); r.registerListener(new MyPOIFSReaderListener(), SummaryInformation.DEFAULT_STREAM_NAME); r.read(new File(filename)); }