]> source.dussan.org Git - poi.git/commitdiff
*** empty log message ***
authorRainer Klute <klute@apache.org>
Mon, 1 Sep 2003 18:54:23 +0000 (18:54 +0000)
committerRainer Klute <klute@apache.org>
Mon, 1 Sep 2003 18:54:23 +0000 (18:54 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353333 13f79535-47bb-0310-9956-ffa450edef68

src/examples/src/org/apache/poi/hpsf/examples/ReadCustomPropertySets.java
src/examples/src/org/apache/poi/hpsf/examples/ReadTitle.java
src/java/org/apache/poi/hpsf/package.html
src/testcases/org/apache/poi/hpsf/basic/TestWrite.java

index d5930824f86e0077824b527b00e4758379cfbd8f..93853f45adb156a9e82ef652eec43372bf00f19c 100644 (file)
  */
 package org.apache.poi.hpsf.examples;
 
-import java.io.*;
-import java.util.*;
-import org.apache.poi.hpsf.*;
-import org.apache.poi.poifs.eventfilesystem.*;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.poi.hpsf.NoPropertySetStreamException;
+import org.apache.poi.hpsf.Property;
+import org.apache.poi.hpsf.PropertySet;
+import org.apache.poi.hpsf.PropertySetFactory;
+import org.apache.poi.hpsf.Section;
+import org.apache.poi.poifs.eventfilesystem.POIFSReader;
+import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent;
+import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener;
 import org.apache.poi.util.HexDump;
 
 /**
@@ -74,7 +83,13 @@ import org.apache.poi.util.HexDump;
 public class ReadCustomPropertySets
 {
 
-    public static void main(String[] args)
+    /**
+     * <p>Runs the example program.</p>
+     *
+     * @param args Command-line arguments (unused).
+     * @throws IOException if any I/O exception occurs.
+     */
+    public static void main(final String[] args)
         throws IOException
     {
         final String filename = args[0];
@@ -88,7 +103,7 @@ public class ReadCustomPropertySets
 
     static class MyPOIFSReaderListener implements POIFSReaderListener
     {
-        public void processPOIFSReaderEvent(POIFSReaderEvent event)
+        public void processPOIFSReaderEvent(final POIFSReaderEvent event)
         {
             PropertySet ps = null;
             try
@@ -138,7 +153,7 @@ public class ReadCustomPropertySets
                 {
                     /* Print a single property: */
                     Property p = properties[i2];
-                    int id = p.getID();
+                    long id = p.getID();
                     long type = p.getType();
                     Object value = p.getValue();
                     out("      Property ID: " + id + ", type: " + type +
@@ -153,7 +168,7 @@ public class ReadCustomPropertySets
         System.out.println(msg);
     }
 
-    static String hex(byte[] bytes)
+    static String hex(final byte[] bytes)
     {
         return HexDump.dump(bytes, 0L, 0);
     }
index 749d14e843017f228183727a146e5c44612f36d5..fcd61542e14a167a6a0db6a0e6987b0c99787e94 100644 (file)
  */
 package org.apache.poi.hpsf.examples;
 
-import java.io.*;
-import org.apache.poi.hpsf.*;
-import org.apache.poi.poifs.eventfilesystem.*;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.apache.poi.hpsf.PropertySetFactory;
+import org.apache.poi.hpsf.SummaryInformation;
+import org.apache.poi.poifs.eventfilesystem.POIFSReader;
+import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent;
+import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener;
 
 /**
  * <p>Sample application showing how to read a OLE 2 document's
@@ -71,8 +76,14 @@ import org.apache.poi.poifs.eventfilesystem.*;
  */
 public class ReadTitle
 {
-
-    public static void main(String[] args) throws IOException
+    /**
+     * <p>Runs the example program.</p>
+     *
+     * @param args Command-line arguments. The first command-line argument must
+     * be the name of a POI filesystem to read.
+     * @throws IOException if any I/O exception occurs.
+     */
+    public static void main(final String[] args) throws IOException
     {
         final String filename = args[0];
         POIFSReader r = new POIFSReader();
@@ -84,7 +95,7 @@ public class ReadTitle
 
     static class MyPOIFSReaderListener implements POIFSReaderListener
     {
-        public void processPOIFSReaderEvent(POIFSReaderEvent event)
+        public void processPOIFSReaderEvent(final POIFSReaderEvent event)
         {
             SummaryInformation si = null;
             try
index 0a186ca144bcebfb13ae73b2cc7c72623c1fa277..31fcb05bf0f3a2043da0da7f7bc2ce3be83a57ba 100644 (file)
@@ -7,8 +7,6 @@
 
  <body>
   <div>
-      Horrible PropertySet Format API reads things like Document Summary info from
-      OLE 2 Compound document files.
    <p>Processes streams in the Horrible Property Set Format (HPSF) in POI
     filesystems. Microsoft Office documents, i.e. POI filesystems, usually
     contain meta data like author, title, last editing date etc. These items
index 390a13f23a4b914e8ea8b1e489269d8ca32a1f67..fbb09a900e4096ade657538caf6935afab34db99 100644 (file)
@@ -211,11 +211,7 @@ public class TestWrite extends TestCase
         si.setProperty(p);
         si.setProperty(PropertyIDMap.PID_TITLE, Variant.VT_LPSTR, TITLE);
 
-        final ByteArrayOutputStream psStream = new ByteArrayOutputStream();
-        ps.write(psStream);
-        psStream.close();
-        final byte[] streamData = psStream.toByteArray();
-        poiFs.createDocument(new ByteArrayInputStream(streamData),
+        poiFs.createDocument(ps.toInputStream(),
                              SummaryInformation.DEFAULT_STREAM_NAME);
         poiFs.writeFilesystem(out);
         out.close();
@@ -225,7 +221,8 @@ public class TestWrite extends TestCase
         final POIFSReader r = new POIFSReader();
         r.registerListener(new POIFSReaderListener()
             {
-                public void processPOIFSReaderEvent(final POIFSReaderEvent event)
+                public void processPOIFSReaderEvent
+                    (final POIFSReaderEvent event)
                 {
                     try
                     {