*** empty log message ***

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353333 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rainer Klute 2003-09-01 18:54:23 +00:00
parent 3aabec7f22
commit fe4ce38e62
4 changed files with 43 additions and 22 deletions

View File

@ -54,10 +54,19 @@
*/
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);
}

View File

@ -54,9 +54,14 @@
*/
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

View 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

View 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
{