*** 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:
parent
3aabec7f22
commit
fe4ce38e62
@ -54,10 +54,19 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.poi.hpsf.examples;
|
package org.apache.poi.hpsf.examples;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.FileInputStream;
|
||||||
import java.util.*;
|
import java.io.IOException;
|
||||||
import org.apache.poi.hpsf.*;
|
import java.util.Iterator;
|
||||||
import org.apache.poi.poifs.eventfilesystem.*;
|
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;
|
import org.apache.poi.util.HexDump;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +83,13 @@ import org.apache.poi.util.HexDump;
|
|||||||
public class ReadCustomPropertySets
|
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
|
throws IOException
|
||||||
{
|
{
|
||||||
final String filename = args[0];
|
final String filename = args[0];
|
||||||
@ -88,7 +103,7 @@ public class ReadCustomPropertySets
|
|||||||
|
|
||||||
static class MyPOIFSReaderListener implements POIFSReaderListener
|
static class MyPOIFSReaderListener implements POIFSReaderListener
|
||||||
{
|
{
|
||||||
public void processPOIFSReaderEvent(POIFSReaderEvent event)
|
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
|
||||||
{
|
{
|
||||||
PropertySet ps = null;
|
PropertySet ps = null;
|
||||||
try
|
try
|
||||||
@ -138,7 +153,7 @@ public class ReadCustomPropertySets
|
|||||||
{
|
{
|
||||||
/* Print a single property: */
|
/* Print a single property: */
|
||||||
Property p = properties[i2];
|
Property p = properties[i2];
|
||||||
int id = p.getID();
|
long id = p.getID();
|
||||||
long type = p.getType();
|
long type = p.getType();
|
||||||
Object value = p.getValue();
|
Object value = p.getValue();
|
||||||
out(" Property ID: " + id + ", type: " + type +
|
out(" Property ID: " + id + ", type: " + type +
|
||||||
@ -153,7 +168,7 @@ public class ReadCustomPropertySets
|
|||||||
System.out.println(msg);
|
System.out.println(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static String hex(byte[] bytes)
|
static String hex(final byte[] bytes)
|
||||||
{
|
{
|
||||||
return HexDump.dump(bytes, 0L, 0);
|
return HexDump.dump(bytes, 0L, 0);
|
||||||
}
|
}
|
||||||
|
@ -54,9 +54,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.poi.hpsf.examples;
|
package org.apache.poi.hpsf.examples;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.FileInputStream;
|
||||||
import org.apache.poi.hpsf.*;
|
import java.io.IOException;
|
||||||
import org.apache.poi.poifs.eventfilesystem.*;
|
|
||||||
|
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
|
* <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 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];
|
final String filename = args[0];
|
||||||
POIFSReader r = new POIFSReader();
|
POIFSReader r = new POIFSReader();
|
||||||
@ -84,7 +95,7 @@ public class ReadTitle
|
|||||||
|
|
||||||
static class MyPOIFSReaderListener implements POIFSReaderListener
|
static class MyPOIFSReaderListener implements POIFSReaderListener
|
||||||
{
|
{
|
||||||
public void processPOIFSReaderEvent(POIFSReaderEvent event)
|
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
|
||||||
{
|
{
|
||||||
SummaryInformation si = null;
|
SummaryInformation si = null;
|
||||||
try
|
try
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<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
|
<p>Processes streams in the Horrible Property Set Format (HPSF) in POI
|
||||||
filesystems. Microsoft Office documents, i.e. POI filesystems, usually
|
filesystems. Microsoft Office documents, i.e. POI filesystems, usually
|
||||||
contain meta data like author, title, last editing date etc. These items
|
contain meta data like author, title, last editing date etc. These items
|
||||||
|
@ -211,11 +211,7 @@ public class TestWrite extends TestCase
|
|||||||
si.setProperty(p);
|
si.setProperty(p);
|
||||||
si.setProperty(PropertyIDMap.PID_TITLE, Variant.VT_LPSTR, TITLE);
|
si.setProperty(PropertyIDMap.PID_TITLE, Variant.VT_LPSTR, TITLE);
|
||||||
|
|
||||||
final ByteArrayOutputStream psStream = new ByteArrayOutputStream();
|
poiFs.createDocument(ps.toInputStream(),
|
||||||
ps.write(psStream);
|
|
||||||
psStream.close();
|
|
||||||
final byte[] streamData = psStream.toByteArray();
|
|
||||||
poiFs.createDocument(new ByteArrayInputStream(streamData),
|
|
||||||
SummaryInformation.DEFAULT_STREAM_NAME);
|
SummaryInformation.DEFAULT_STREAM_NAME);
|
||||||
poiFs.writeFilesystem(out);
|
poiFs.writeFilesystem(out);
|
||||||
out.close();
|
out.close();
|
||||||
@ -225,7 +221,8 @@ public class TestWrite extends TestCase
|
|||||||
final POIFSReader r = new POIFSReader();
|
final POIFSReader r = new POIFSReader();
|
||||||
r.registerListener(new POIFSReaderListener()
|
r.registerListener(new POIFSReaderListener()
|
||||||
{
|
{
|
||||||
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
|
public void processPOIFSReaderEvent
|
||||||
|
(final POIFSReaderEvent event)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user