You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2013/06/26 02:10:44 UTC

svn commit: r1496680 - in /poi/trunk/src/java/org/apache/poi/hpsf: HPSFPropertiesOnlyDocument.java extractor/HPSFPropertiesExtractor.java

Author: nick
Date: Wed Jun 26 00:10:43 2013
New Revision: 1496680

URL: http://svn.apache.org/r1496680
Log:
Pull the Properties-Only document type out to a superclass, so other places (eg unit tests) can use it

Added:
    poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java
Modified:
    poi/trunk/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java

Added: poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java?rev=1496680&view=auto
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java (added)
+++ poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java Wed Jun 26 00:10:43 2013
@@ -0,0 +1,26 @@
+package org.apache.poi.hpsf;
+
+import java.io.OutputStream;
+
+import org.apache.poi.POIDocument;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+
+/**
+ * A version of {@link POIDocument} which allows access to the
+ *  HPSF Properties, but no other document contents.
+ * Normally used when you want to read or alter the Document Properties,
+ *  without affecting the rest of the file
+ */
+public class HPSFPropertiesOnlyDocument extends POIDocument {
+    public HPSFPropertiesOnlyDocument(NPOIFSFileSystem fs) {
+        super(fs.getRoot());
+    }
+    public HPSFPropertiesOnlyDocument(POIFSFileSystem fs) {
+        super(fs);
+    }
+
+    public void write(OutputStream out) {
+        throw new IllegalStateException("Unable to write, only for properties!");
+    }
+}
\ No newline at end of file

Modified: poi/trunk/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java?rev=1496680&r1=1496679&r2=1496680&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java Wed Jun 26 00:10:43 2013
@@ -19,13 +19,13 @@ package org.apache.poi.hpsf.extractor;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.OutputStream;
 import java.util.Iterator;
 
 import org.apache.poi.POIDocument;
 import org.apache.poi.POITextExtractor;
 import org.apache.poi.hpsf.CustomProperties;
 import org.apache.poi.hpsf.DocumentSummaryInformation;
+import org.apache.poi.hpsf.HPSFPropertiesOnlyDocument;
 import org.apache.poi.hpsf.Property;
 import org.apache.poi.hpsf.SpecialPropertySet;
 import org.apache.poi.hpsf.SummaryInformation;
@@ -47,10 +47,10 @@ public class HPSFPropertiesExtractor ext
         super(doc);
     }
     public HPSFPropertiesExtractor(POIFSFileSystem fs) {
-        super(new PropertiesOnlyDocument(fs));
+        super(new HPSFPropertiesOnlyDocument(fs));
     }
     public HPSFPropertiesExtractor(NPOIFSFileSystem fs) {
-        super(new PropertiesOnlyDocument(fs));
+        super(new HPSFPropertiesOnlyDocument(fs));
     }
 
     public String getDocumentSummaryInformationText() {
@@ -143,23 +143,6 @@ public class HPSFPropertiesExtractor ext
         throw new IllegalStateException("You already have the Metadata Text Extractor, not recursing!");
     }
 
-    /**
-     * So we can get at the properties of any
-     *  random OLE2 document.
-     */
-    private static final class PropertiesOnlyDocument extends POIDocument {
-        public PropertiesOnlyDocument(NPOIFSFileSystem fs) {
-            super(fs.getRoot());
-        }
-        public PropertiesOnlyDocument(POIFSFileSystem fs) {
-            super(fs);
-        }
-
-        public void write(OutputStream out) {
-            throw new IllegalStateException("Unable to write, only for properties!");
-        }
-    }
-
     public static void main(String[] args) throws IOException {
         for (String file : args) {
             HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org