/** * Creates a SlideShow from the given NPOIFSFileSystem. * * @param root The {@link DirectoryNode} to start reading the document from * * @return The created SlideShow * * @throws IOException if an error occurs while reading the data */ public static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> create(final DirectoryNode root) throws IOException { return create(root, null); }
private static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> createHSLFSlideShow(Object... args) throws IOException, EncryptedDocumentException { return createSlideShow("org.apache.poi.hslf.usermodel.HSLFSlideShowFactory", args); }
try { fs = new POIFSFileSystem(file, readOnly); return create(fs, password); } catch(OfficeXmlFileException e) { IOUtils.closeQuietly(fs); return createXSLFSlideShow(file, readOnly); } catch(RuntimeException e) { IOUtils.closeQuietly(fs);
stream = DocumentFactoryHelper.getDecryptedStream(root, password); return createXSLFSlideShow(stream); } finally { IOUtils.closeQuietly(stream); return createHSLFSlideShow(root); } finally { if (passwordSet) {
stream = DocumentFactoryHelper.getDecryptedStream(root, password); return createXSLFSlideShow(stream); } finally { IOUtils.closeQuietly(stream); return createHSLFSlideShow(root); } finally { if (passwordSet) {
/** * Creates a SlideShow from the given NPOIFSFileSystem. * * @param fs The {@link POIFSFileSystem} to read the document from * * @return The created SlideShow * * @throws IOException if an error occurs while reading the data */ public static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> create(POIFSFileSystem fs) throws IOException { return create(fs, null); }
case OLE2: POIFSFileSystem fs = new POIFSFileSystem(is); return create(fs, password); case OOXML: return createXSLFSlideShow(is); default: throw new IOException("Your InputStream was neither an OLE2 stream, nor an OOXML stream");
private static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> createXSLFSlideShow(Object... args) throws IOException, EncryptedDocumentException { return createSlideShow("org.apache.poi.xslf.usermodel.XSLFSlideShowFactory", args); }
/** * Creates the appropriate HSLFSlideShow / XMLSlideShow from * the given File, which must exist and be readable, and * may be password protected * <p>Note that in order to properly release resources the * SlideShow should be closed after use. * * @param file The file to read data from. * @param password The password that should be used or null if no password is necessary. * * @return The created SlideShow * * @throws IOException if an error occurs while reading the data * @throws EncryptedDocumentException If the wrong password is given for a protected file */ public static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> create(File file, String password) throws IOException, EncryptedDocumentException { return create(file, password, false); }
try { fs = new POIFSFileSystem(file, readOnly); return create(fs, password); } catch(OfficeXmlFileException e) { IOUtils.closeQuietly(fs); return createXSLFSlideShow(file, readOnly); } catch(RuntimeException e) { IOUtils.closeQuietly(fs);
private static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> createHSLFSlideShow(Object... args) throws IOException, EncryptedDocumentException { return createSlideShow("org.apache.poi.hslf.usermodel.HSLFSlideShowFactory", args); }
/** * Creates the appropriate HSLFSlideShow / XMLSlideShow from * the given File, which must exist and be readable. * <p>Note that in order to properly release resources the * SlideShow should be closed after use. * * @param file The file to read data from. * * @return The created SlideShow * * @throws IOException if an error occurs while reading the data * @throws EncryptedDocumentException If the SlideShow given is password protected */ public static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> create(File file) throws IOException, EncryptedDocumentException { return create(file, null); }
case OLE2: POIFSFileSystem fs = new POIFSFileSystem(is); return create(fs, password); case OOXML: return createXSLFSlideShow(is); default: throw new IOException("Your InputStream was neither an OLE2 stream, nor an OOXML stream");
private static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> createXSLFSlideShow(Object... args) throws IOException, EncryptedDocumentException { return createSlideShow("org.apache.poi.xslf.usermodel.XSLFSlideShowFactory", args); }
/** * Creates the appropriate HSLFSlideShow / XMLSlideShow from * the given InputStream. * * <p>Note that using an {@link InputStream} has a higher memory footprint * than using a {@link File}.</p> * * <p>Note that in order to properly release resources the * SlideShow should be closed after use. Note also that loading * from an InputStream requires more memory than loading * from a File, so prefer {@link #create(File)} where possible. * * @param inp The {@link InputStream} to read data from. * * @return The created SlideShow * * @throws IOException if an error occurs while reading the data * @throws EncryptedDocumentException If the SlideShow given is password protected */ public static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> create(InputStream inp) throws IOException, EncryptedDocumentException { return create(inp, null); }
/** * Creates a SlideShow from the given NPOIFSFileSystem, which may * be password protected * * @param fs The {@link POIFSFileSystem} to read the document from * @param password The password that should be used or null if no password is necessary. * * @return The created SlideShow * * @throws IOException if an error occurs while reading the data */ public static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> create(final POIFSFileSystem fs, String password) throws IOException { return create(fs.getRoot(), password); }
System.out.println("Processing " + file); try (SlideShow<?, ?> ss = SlideShowFactory.create(file, null, true)) { List<? extends Slide<?, ?>> slides = ss.getSlides();
/** * Creates a SlideShow from the given NPOIFSFileSystem. * * @param fs The {@link POIFSFileSystem} to read the document from * * @return The created SlideShow * * @throws IOException if an error occurs while reading the data */ public static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> create(POIFSFileSystem fs) throws IOException { return create(fs, null); }
/** * Creates a SlideShow from the given NPOIFSFileSystem. * * @param root The {@link DirectoryNode} to start reading the document from * * @return The created SlideShow * * @throws IOException if an error occurs while reading the data */ public static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> create(final DirectoryNode root) throws IOException { return create(root, null); }
/** * Creates the appropriate HSLFSlideShow / XMLSlideShow from * the given File, which must exist and be readable. * <p>Note that in order to properly release resources the * SlideShow should be closed after use. * * @param file The file to read data from. * * @return The created SlideShow * * @throws IOException if an error occurs while reading the data * @throws EncryptedDocumentException If the SlideShow given is password protected */ public static < S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > SlideShow<S,P> create(File file) throws IOException, EncryptedDocumentException { return create(file, null); }