]> source.dussan.org Git - poi.git/commitdiff
Add constructors taking the main objects, rather than just input streams
authorNick Burch <nick@apache.org>
Wed, 5 Apr 2006 14:04:32 +0000 (14:04 +0000)
committerNick Burch <nick@apache.org>
Wed, 5 Apr 2006 14:04:32 +0000 (14:04 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@391617 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
src/scratchpad/src/org/apache/poi/hwpf/extractor/WordExtractor.java

index 8db7382e9718ffa94ca98ac23fda3b8a9c5afdc3..5b1c3d5a5a3aef3664a53465d0f18fc95db04ef4 100644 (file)
@@ -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
index 5be1b8f8a8136f10064d9e1de95ddf00fdacdfeb..d34fa78c26dd3738cdbf16fde0334c2c7d241191 100644 (file)
@@ -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;
        }
        
        /**