org.apache.poi.hpsf
Class SpecialPropertySet

java.lang.Object
  extended byorg.apache.poi.hpsf.PropertySet
      extended byorg.apache.poi.hpsf.SpecialPropertySet
Direct Known Subclasses:
DocumentSummaryInformation, SummaryInformation

public abstract class SpecialPropertySet
extends PropertySet

Abstract superclass for the convenience classes SummaryInformation and DocumentSummaryInformation.

The motivation behind this class is quite nasty if you look behind the scenes, but it serves the application programmer well by providing him with the easy-to-use SummaryInformation and DocumentSummaryInformation classes. When parsing the data a property set stream consists of (possibly coming from an InputStream) we want to read and process each byte only once. Since we don't know in advance which kind of property set we have, we can expect only the most general PropertySet. Creating a special subclass should be as easy as calling the special subclass' constructor and pass the general PropertySet in. To make things easy internally, the special class just holds a reference to the general PropertySet and delegates all method calls to it.

A cleaner implementation would have been like this: The PropertySetFactory parses the stream data into some internal object first. Then it finds out whether the stream is a SummaryInformation, a DocumentSummaryInformation or a general PropertySet. However, the current implementation went the other way round historically: the convenience classes came only late to my mind.

Since:
2002-02-09
Version:
$Id: SpecialPropertySet.java,v 1.11 2004/04/09 13:05:16 glens Exp $
Author:
Rainer Klute <klute@rainer-klute.de>

Field Summary
 
Fields inherited from class org.apache.poi.hpsf.PropertySet
byteOrder, classID, format, OS_MACINTOSH, OS_WIN16, OS_WIN32, osVersion, sections
 
Constructor Summary
SpecialPropertySet(PropertySet ps)
          Creates a SpecialPropertySet.
 
Method Summary
 int getByteOrder()
          Returns the property set stream's low-level "byte order" field.
 ClassID getClassID()
          Returns the property set stream's low-level "class ID" field.
 int getFormat()
          Returns the property set stream's low-level "format" field.
 int getOSVersion()
          Returns the property set stream's low-level "OS version" field.
 int getSectionCount()
          Returns the number of Sections in the property set.
 java.util.List getSections()
          Returns the Sections in the property set.
 Section getSingleSection()
          If the PropertySet has only a single section this method returns it.
 boolean isDocumentSummaryInformation()
          Checks whether this PropertySet is a Document Summary Information.
 boolean isSummaryInformation()
          Checks whether this PropertySet represents a Summary Information.
 
Methods inherited from class org.apache.poi.hpsf.PropertySet
equals, getProperties, getProperty, getPropertyBooleanValue, getPropertyIntValue, hashCode, isPropertySetStream, isPropertySetStream, toString, wasNull
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpecialPropertySet

public SpecialPropertySet(PropertySet ps)

Creates a SpecialPropertySet.

Parameters:
ps - The property set encapsulated by the SpecialPropertySet
Method Detail

getByteOrder

public int getByteOrder()
Description copied from class: PropertySet

Returns the property set stream's low-level "byte order" field. It is always 0xFFFE .

Overrides:
getByteOrder in class PropertySet
Returns:
The property set stream's low-level "byte order" field.
See Also:
PropertySet.getByteOrder()

getFormat

public int getFormat()
Description copied from class: PropertySet

Returns the property set stream's low-level "format" field. It is always 0x0000 .

Overrides:
getFormat in class PropertySet
Returns:
The property set stream's low-level "format" field.
See Also:
PropertySet.getFormat()

getOSVersion

public int getOSVersion()
Description copied from class: PropertySet

Returns the property set stream's low-level "OS version" field.

Overrides:
getOSVersion in class PropertySet
Returns:
The property set stream's low-level "OS version" field.
See Also:
PropertySet.getOSVersion()

getClassID

public ClassID getClassID()
Description copied from class: PropertySet

Returns the property set stream's low-level "class ID" field.

Overrides:
getClassID in class PropertySet
Returns:
The property set stream's low-level "class ID" field.
See Also:
PropertySet.getClassID()

getSectionCount

public int getSectionCount()
Description copied from class: PropertySet

Returns the number of Sections in the property set.

Overrides:
getSectionCount in class PropertySet
Returns:
The number of Sections in the property set.
See Also:
PropertySet.getSectionCount()

getSections

public java.util.List getSections()
Description copied from class: PropertySet

Returns the Sections in the property set.

Overrides:
getSections in class PropertySet
Returns:
The Sections in the property set.
See Also:
PropertySet.getSections()

isSummaryInformation

public boolean isSummaryInformation()
Description copied from class: PropertySet

Checks whether this PropertySet represents a Summary Information.

Overrides:
isSummaryInformation in class PropertySet
Returns:
true if this PropertySet represents a Summary Information, else false.
See Also:
PropertySet.isSummaryInformation()

isDocumentSummaryInformation

public boolean isDocumentSummaryInformation()
Description copied from class: PropertySet

Checks whether this PropertySet is a Document Summary Information.

Overrides:
isDocumentSummaryInformation in class PropertySet
Returns:
true if this PropertySet represents a Document Summary Information, else false.
See Also:
PropertySet.isDocumentSummaryInformation()

getSingleSection

public Section getSingleSection()
Description copied from class: PropertySet

If the PropertySet has only a single section this method returns it.

Overrides:
getSingleSection in class PropertySet
Returns:
The singleSection value
See Also:
PropertySet.getSingleSection()


Copyright 2005 The Apache Software Foundation or its licensors, as applicable.