Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Package org.apache.poi.hpsf.wellknown

Horrible PropertySet Format API reads things like Document Summary info from OLE 2 Compound document files.

See:
          Description

Class Summary
PropertyIDMap This is a dictionary which maps property ID values to property ID strings.
SectionIDMap Maps section format IDs to PropertyIDMaps.
 

Package org.apache.poi.hpsf.wellknown Description

Horrible PropertySet Format API reads things like Document Summary info from OLE 2 Compound document files.

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 are called properties and stored in property set streams along with the document itself. These streams are commonly named \005SummaryInformation and \005DocumentSummaryInformation. However, a POI filesystem may contain further property sets of other names or types.

In order to extract the properties from a POI filesystem, a property set stream's contents must be parsed into a org.apache.poi.hpsf.PropertySet instance. Its subclasses org.apache.poi.hpsf.SummaryInformation and org.apache.poi.hpsf.DocumentSummaryInformation deal with the well-known property set streams \005SummaryInformation and \005DocumentSummaryInformation. (However, the streams' names are irrelevant. What counts is the property set's first section's format ID - see below.)

The factory method PropertySetFactory.create(java.io.InputStream)>PropertySetFactory.create(java.io.InputStream) 55 creates a org.apache.poi.hpsf.PropertySet instance. This method always returns the most specific property set: If it identifies the stream data as a Summary Information or as a Document Summary Information it returns an instance of the corresponding class, else the general org.apache.poi.hpsf.PropertySet.

A org.apache.poi.hpsf.PropertySet contains a list of org.apache.poi.hpsf.Sections which can be retrieved with PropertySet.getSections()>PropertySet.getSections() 55 . Each org.apache.poi.hpsf.Section contains a org.apache.poi.hpsf.Property array which can be retrieved with Section.getProperties()>Section.getProperties() 55 . Since the vast majority of org.apache.poi.hpsf.PropertySets contains only a single org.apache.poi.hpsf.Section, the convenience method PropertySet.getProperties()>PropertySet.getProperties() 55 returns the properties of a org.apache.poi.hpsf.PropertySet's org.apache.poi.hpsf.Section (throwing a org.apache.poi.hpsf.NoSingleSectionException if the org.apache.poi.hpsf.PropertySet contains more (or less) than exactly one org.apache.poi.hpsf.Section).

Each org.apache.poi.hpsf.Property has an ID, a type, and a value which can be retrieved with Property.getID()>Property.getID() 55 , Property.getType()>Property.getType() 55 , and Property.getValue()>Property.getValue() 55 , respectively. The value's class depends on the property's type. The current implementation does not yet support all property types and restricts the values' classes to java.lang.String, java.lang.Integer and java.util.Date. A value of a yet unknown type is returned as a byte array containing the value's origin bytes from the property set stream.

To retrieve the value of a specific org.apache.poi.hpsf.Property, use Section.getProperty(int)>Section.getProperty(int) 55 or Section.getPropertyIntValue(int)>Section.getPropertyIntValue(int) 55 .

The org.apache.poi.hpsf.SummaryInformation and org.apache.poi.hpsf.DocumentSummaryInformation classes provide convenience methods for retrieving well-known properties. For example, an application that wants to retrieve a document's title string just calls SummaryInformation.getTitle()>SummaryInformation.getTitle() 55 instead of going through the hassle of first finding out what the title's property ID is and then using this ID to get the property's value.

To Do

The following is still left to be implemented:

  • Property dictionaries

  • Writing property sets

  • Codepage support

  • Property type Unicode string

  • Further property types

Since:
2002-02-09

Version:
$Id: package.html,v 1.3.8.1 2004/02/28 12:55:57 glens Exp $