@SuppressWarnings("unchecked") public static <T extends POITextExtractor> T createExtractor(POIFSFileSystem fs) throws IOException { return (T)createExtractor(fs.getRoot()); }
@SuppressWarnings("unchecked") public static <T extends POITextExtractor> T createExtractor(InputStream input) throws IOException { Class<?> cls = getOOXMLClass(); if (cls != null) { // Use Reflection to get us the full OOXML-enabled version try { Method m = cls.getDeclaredMethod("createExtractor", InputStream.class); return (T)m.invoke(null, input); } catch (IllegalArgumentException iae) { throw iae; } catch (Exception e) { throw new IllegalArgumentException("Error creating Extractor for InputStream", e); } } else { // Best hope it's OLE2.... return createExtractor(new POIFSFileSystem(input)); } }
@SuppressWarnings("unchecked") public static <T extends POITextExtractor> T createExtractor(DirectoryNode poifsDir) throws IOException, OpenXML4JException, XmlException { // First, check for OOXML for (String entryName : poifsDir.getEntryNames()) { if (entryName.equals("Package")) { OPCPackage pkg = OPCPackage.open(poifsDir.createDocumentInputStream("Package")); return (T)createExtractor(pkg); } } // If not, ask the OLE2 code to check, with Scratchpad if possible return (T)OLE2ExtractorFactory.createExtractor(poifsDir); }
e.add(createExtractor((DirectoryNode) dir )); e.add(createExtractor(stream)); } catch (Exception xe) {
@SuppressWarnings("unchecked") public static <T extends POITextExtractor> T createExtractor(POIFSFileSystem fs) throws IOException { return (T)createExtractor(fs.getRoot()); }
@SuppressWarnings("unchecked") public static <T extends POITextExtractor> T createExtractor(InputStream input) throws IOException { Class<?> cls = getOOXMLClass(); if (cls != null) { // Use Reflection to get us the full OOXML-enabled version try { Method m = cls.getDeclaredMethod("createExtractor", InputStream.class); return (T)m.invoke(null, input); } catch (IllegalArgumentException iae) { throw iae; } catch (Exception e) { throw new IllegalArgumentException("Error creating Extractor for InputStream", e); } } else { // Best hope it's OLE2.... return createExtractor(new POIFSFileSystem(input)); } }
@SuppressWarnings("unchecked") public static <T extends POITextExtractor> T createExtractor(DirectoryNode poifsDir) throws IOException, OpenXML4JException, XmlException { // First, check for OOXML for (String entryName : poifsDir.getEntryNames()) { if (entryName.equals("Package")) { OPCPackage pkg = OPCPackage.open(poifsDir.createDocumentInputStream("Package")); return (T)createExtractor(pkg); } } // If not, ask the OLE2 code to check, with Scratchpad if possible return (T)OLE2ExtractorFactory.createExtractor(poifsDir); }
e.add(createExtractor((DirectoryNode) dir )); e.add(createExtractor(stream)); } catch (Exception xe) {