|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.poi.hpsf.PropertySet
org.apache.poi.hpsf.MutablePropertySet
org.apache.poi.hpsf.SpecialPropertySet
public abstract class SpecialPropertySet
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.
| 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(MutablePropertySet ps)
Creates a SpecialPropertySet. |
|
SpecialPropertySet(PropertySet ps)
Creates a SpecialPropertySet. |
|
| Method Summary | |
|---|---|
void |
addSection(Section section)
Adds a section to this property set. |
void |
clearSections()
Removes all sections from this property set. |
boolean |
equals(java.lang.Object o)
Returns true if the PropertySet is equal
to the specified parameter, else false. |
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. |
Section |
getFirstSection()
Gets the PropertySet's first section. |
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. |
Property[] |
getProperties()
Convenience method returning the Property array
contained in this property set. |
protected java.lang.Object |
getProperty(int id)
Convenience method returning the value of the property with the specified ID. |
protected boolean |
getPropertyBooleanValue(int id)
Convenience method returning the value of a boolean property with the specified ID. |
protected int |
getPropertyIntValue(int id)
Convenience method returning the value of the numeric property with the specified ID. |
int |
getSectionCount()
Returns the number of Sections in the property
set. |
java.util.List |
getSections()
Returns the Sections in the property set. |
int |
hashCode()
|
boolean |
isDocumentSummaryInformation()
Checks whether this PropertySet is a Document
Summary Information. |
boolean |
isSummaryInformation()
Checks whether this PropertySet represents a Summary
Information. |
void |
setByteOrder(int byteOrder)
Sets the "byteOrder" property. |
void |
setClassID(ClassID classID)
Sets the property set stream's low-level "class ID" field. |
void |
setFormat(int format)
Sets the "format" property. |
void |
setOSVersion(int osVersion)
Sets the "osVersion" property. |
java.io.InputStream |
toInputStream()
Returns the contents of this property set stream as an input stream. |
java.lang.String |
toString()
|
boolean |
wasNull()
Checks whether the property which the last call to PropertySet.getPropertyIntValue(int) or PropertySet.getProperty(int) tried to access
was available or not. |
void |
write(DirectoryEntry dir,
java.lang.String name)
Writes a property set to a document in a POI filesystem directory. |
void |
write(java.io.OutputStream out)
Writes the property set to an output stream. |
| Methods inherited from class org.apache.poi.hpsf.PropertySet |
|---|
getSingleSection, isPropertySetStream, isPropertySetStream |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SpecialPropertySet(PropertySet ps)
Creates a SpecialPropertySet.
ps - The property set to be encapsulated by the
SpecialPropertySetpublic SpecialPropertySet(MutablePropertySet ps)
Creates a SpecialPropertySet.
ps - The mutable property set to be encapsulated by the
SpecialPropertySet| Method Detail |
|---|
public int getByteOrder()
PropertySetReturns the property set stream's low-level "byte order" field. It is always 0xFFFE .
getByteOrder in class PropertySetPropertySet.getByteOrder()public int getFormat()
PropertySetReturns the property set stream's low-level "format" field. It is always 0x0000 .
getFormat in class PropertySetPropertySet.getFormat()public int getOSVersion()
PropertySetReturns the property set stream's low-level "OS version" field.
getOSVersion in class PropertySetPropertySet.getOSVersion()public ClassID getClassID()
PropertySetReturns the property set stream's low-level "class ID" field.
getClassID in class PropertySetPropertySet.getClassID()public int getSectionCount()
PropertySetReturns the number of Sections in the property
set.
getSectionCount in class PropertySetSections in the property set.PropertySet.getSectionCount()public java.util.List getSections()
PropertySetReturns the Sections in the property set.
getSections in class PropertySetSections in the property set.PropertySet.getSections()public boolean isSummaryInformation()
PropertySetChecks whether this PropertySet represents a Summary
Information.
isSummaryInformation in class PropertySettrue if this PropertySet
represents a Summary Information, else false.PropertySet.isSummaryInformation()public boolean isDocumentSummaryInformation()
PropertySetChecks whether this PropertySet is a Document
Summary Information.
isDocumentSummaryInformation in class PropertySettrue if this PropertySet
represents a Document Summary Information, else false.PropertySet.isDocumentSummaryInformation()public Section getFirstSection()
PropertySetGets the PropertySet's first section.
getFirstSection in class PropertySetPropertySet's first section.PropertySet.getSingleSection()public void addSection(Section section)
MutablePropertySetAdds a section to this property set.
addSection in class MutablePropertySetsection - The Section to add. It will be appended
after any sections that are already present in the property set
and thus become the last section.MutablePropertySet.addSection(org.apache.poi.hpsf.Section)public void clearSections()
MutablePropertySetRemoves all sections from this property set.
clearSections in class MutablePropertySetMutablePropertySet.clearSections()public void setByteOrder(int byteOrder)
MutablePropertySetSets the "byteOrder" property.
setByteOrder in class MutablePropertySetbyteOrder - the byteOrder value to setMutablePropertySet.setByteOrder(int)public void setClassID(ClassID classID)
MutablePropertySetSets the property set stream's low-level "class ID" field.
setClassID in class MutablePropertySetclassID - The property set stream's low-level "class ID" field.MutablePropertySet.setClassID(org.apache.poi.hpsf.ClassID)public void setFormat(int format)
MutablePropertySetSets the "format" property.
setFormat in class MutablePropertySetformat - the format value to setMutablePropertySet.setFormat(int)public void setOSVersion(int osVersion)
MutablePropertySetSets the "osVersion" property.
setOSVersion in class MutablePropertySetosVersion - the osVersion value to setMutablePropertySet.setOSVersion(int)
public java.io.InputStream toInputStream()
throws java.io.IOException,
WritingNotSupportedException
MutablePropertySetReturns the contents of this property set stream as an input stream.
The latter can be used for example to write the property set into a POIFS
document. The input stream represents a snapshot of the property set.
If the latter is modified while the input stream is still being
read, the modifications will not be reflected in the input stream but in
the MutablePropertySet only.
toInputStream in class MutablePropertySetjava.io.IOException - if an I/O exception occurs.
WritingNotSupportedException - if HPSF does not yet support writing
of a property's variant type.MutablePropertySet.toInputStream()
public void write(DirectoryEntry dir,
java.lang.String name)
throws WritingNotSupportedException,
java.io.IOException
MutablePropertySetWrites a property set to a document in a POI filesystem directory.
write in class MutablePropertySetdir - The directory in the POI filesystem to write the document to.name - The document's name. If there is already a document with the
same name in the directory the latter will be overwritten.
WritingNotSupportedException
java.io.IOExceptionMutablePropertySet.write(org.apache.poi.poifs.filesystem.DirectoryEntry, java.lang.String)
public void write(java.io.OutputStream out)
throws WritingNotSupportedException,
java.io.IOException
MutablePropertySetWrites the property set to an output stream.
write in class MutablePropertySetout - the output stream to write the section to
WritingNotSupportedException - if HPSF does not yet support
writing a property's variant type.
java.io.IOException - if an error when writing to the output stream
occursMutablePropertySet.write(java.io.OutputStream)public boolean equals(java.lang.Object o)
PropertySetReturns true if the PropertySet is equal
to the specified parameter, else false.
equals in class PropertySeto - the object to compare this PropertySet with
true if the objects are equal, false
if notPropertySet.equals(java.lang.Object)
public Property[] getProperties()
throws NoSingleSectionException
PropertySetConvenience method returning the Property array
contained in this property set. It is a shortcut for getting
the PropertySet's Sections list and then
getting the Property array from the first Section.
getProperties in class PropertySetSection of this
PropertySet.
NoSingleSectionException - if the PropertySet has
more or less than one Section.PropertySet.getProperties()
protected java.lang.Object getProperty(int id)
throws NoSingleSectionException
PropertySetConvenience method returning the value of the property with
the specified ID. If the property is not available,
null is returned and a subsequent call to PropertySet.wasNull() will return true .
getProperty in class PropertySetid - The property ID
NoSingleSectionException - if the PropertySet has
more or less than one Section.PropertySet.getProperty(int)
protected boolean getPropertyBooleanValue(int id)
throws NoSingleSectionException
PropertySetConvenience method returning the value of a boolean property
with the specified ID. If the property is not available,
false is returned. A subsequent call to PropertySet.wasNull() will return true to let the caller
distinguish that case from a real property value of
false.
getPropertyBooleanValue in class PropertySetid - The property ID
NoSingleSectionException - if the PropertySet has
more or less than one Section.PropertySet.getPropertyBooleanValue(int)
protected int getPropertyIntValue(int id)
throws NoSingleSectionException
PropertySetConvenience method returning the value of the numeric
property with the specified ID. If the property is not
available, 0 is returned. A subsequent call to PropertySet.wasNull()
will return true to let the caller distinguish
that case from a real property value of 0.
getPropertyIntValue in class PropertySetid - The property ID
NoSingleSectionException - if the PropertySet has
more or less than one Section.PropertySet.getPropertyIntValue(int)public int hashCode()
hashCode in class PropertySetPropertySet.hashCode()public java.lang.String toString()
toString in class PropertySetPropertySet.toString()
public boolean wasNull()
throws NoSingleSectionException
PropertySetChecks whether the property which the last call to PropertySet.getPropertyIntValue(int) or PropertySet.getProperty(int) tried to access
was available or not. This information might be important for
callers of PropertySet.getPropertyIntValue(int) since the latter
returns 0 if the property does not exist. Using PropertySet.wasNull(), the caller can distiguish this case from a
property's real value of 0.
wasNull in class PropertySettrue if the last call to PropertySet.getPropertyIntValue(int) or PropertySet.getProperty(int) tried to access a
property that was not available, else false.
NoSingleSectionException - if the PropertySet has
more than one Section.PropertySet.wasNull()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||