PowerPointMetadataReader { public static PowerpointMetadata instance( InputStream stream ) throws IOException { POIFSFileSystem fs = new POIFSFileSystem(stream); HSLFSlideShow rawSlideShow = new HSLFSlideShow(fs); List<SlideMetadata> slidesMetadata = rawSlideShow.getSlides() .stream() .map(slide -> processSlide(rawSlideShow, slide)) .collect(Collectors.toList()); PowerpointMetadata deck = new PowerpointMetadata(); deck.setSlides(slidesMetadata); deck.setMetadata(new HSLFSlideShowImpl(fs).getSummaryInformation()); return deck; }  static PowerpointMetadata instance( InputStream stream );  }
@Test public void shouldBeAbleToCreateMetadataForPowerPoint() throws Exception { InputStream is = getClass().getClassLoader().getResourceAsStream("powerpoint.ppt"); PowerpointMetadata powerpointMetadata = PowerPointMetadataReader.instance(is); SlideMetadata slide = powerpointMetadata.getSlides().get(0); assertThat(slide.getTitle(), is("Test Slide")); assertThat(slide.getText(), is("This is some text")); assertThat(slide.getNotes(), is("My notes")); assertNotNull(slide.getThumbnail()); }