From 0ce1e5a77cf153a248197637224b65a527b2318a Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 5 Apr 2006 14:04:32 +0000 Subject: [PATCH] Add constructors taking the main objects, rather than just input streams git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@391617 13f79535-47bb-0310-9956-ffa450edef68 --- .../hslf/extractor/PowerPointExtractor.java | 23 ++++++++++++++----- .../poi/hwpf/extractor/WordExtractor.java | 10 +++++++- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java b/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java index 8db7382e9..5b1c3d5a5 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java +++ b/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java @@ -66,8 +66,8 @@ public class PowerPointExtractor } /** - * Creates a PowerPointExtractor - * @param fileName + * Creates a PowerPointExtractor, from a file + * @param fileName The name of the file to extract from */ public PowerPointExtractor(String fileName) throws IOException { _hslfshow = new HSLFSlideShow(fileName); @@ -77,8 +77,8 @@ public class PowerPointExtractor } /** - * Creates a PowerPointExtractor - * @param iStream + * Creates a PowerPointExtractor, from an Input Stream + * @param iStream The input stream containing the PowerPoint document */ public PowerPointExtractor(InputStream iStream) throws IOException { _hslfshow = new HSLFSlideShow(iStream); @@ -88,8 +88,8 @@ public class PowerPointExtractor } /** - * Creates a PowerPointExtractor - * @param fs + * Creates a PowerPointExtractor, from an open POIFSFileSystem + * @param fs the POIFSFileSystem containing the PowerPoint document */ public PowerPointExtractor(POIFSFileSystem fs) throws IOException { _hslfshow = new HSLFSlideShow(fs); @@ -98,6 +98,17 @@ public class PowerPointExtractor _notes = _show.getNotes(); } + /** + * Creates a PowerPointExtractor, from a HSLFSlideShow + * @param ss the HSLFSlideShow to extract text from + */ + public PowerPointExtractor(HSLFSlideShow ss) throws IOException { + _hslfshow = ss; + _show = new SlideShow(_hslfshow); + _slides = _show.getSlides(); + _notes = _show.getNotes(); + } + /** * Shuts down the underlying streams diff --git a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java b/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java index 5be1b8f8a..d34fa78c2 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java @@ -36,8 +36,16 @@ public class WordExtractor { * @param fs POIFSFileSystem containing the word file */ public WordExtractor(POIFSFileSystem fs) throws IOException { + this(new HWPFDocument(fs)); this.fs = fs; - doc = new HWPFDocument(fs); + } + + /** + * Create a new Word Extractor + * @param doc The HWPFDocument to extract from + */ + public WordExtractor(HWPFDocument doc) throws IOException { + this.doc = doc; } /**