--- /dev/null
+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
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;
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() {
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(