An application that wants to access these metadata should create
an instance of this class or one of its subclasses by calling the
factory method PropertySetFactory#create and then retrieve
the information its needs by calling appropriate methods.
PropertySetFactory#create does its work by calling one
of the constructors PropertySet#PropertySet(InputStream) or
PropertySet#PropertySet(byte[]). If the constructor's
argument is not in the Horrible Property Set Format, i.e. not a
property set stream, or if any other error occurs, an appropriate
exception is thrown.
A PropertySet has a list of Sections, and each
Section has a Property array. Use getSections to retrieve the Sections, then call Section#getProperties for each Section to get hold of the
Property arrays.
Since the vast majority of PropertySets contains only a single
Section, the convenience method getProperties returns
the properties of a PropertySet's Section (throwing a
NoSingleSectionException if the PropertySet contains
more (or less) than exactly one Section).
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final int | BYTE_ORDER_ASSERTION
The "byteOrder" field must equal this value. |
| private int | byteOrder
Specifies this |
| private ClassID | classID
Specifies this |
| private int | format
Specifies this |
| pack-priv static final int | FORMAT_ASSERTION
The "format" field must equal this value. |
| pack-priv static final int | OFFSET_HEADER
The length of the property set stream header. |
| public static final int | OS_MACINTOSH
If the OS version field holds this value the property set stream was created on a Macintosh system. |
| public static final int | OS_WIN16
If the OS version field holds this value the property set stream was created on a 16-bit Windows system. |
| public static final int | OS_WIN32
If the OS version field holds this value the property set stream was created on a 32-bit Windows system. |
| private int | osVersion
Specifies the version of the operating system that created this
|
| private final List | sections
The sections in this |
| Access | Constructor and Description |
|---|---|
| public | |
| public | PropertySet(final InputStream
Holds the data making out the property set
stream. stream)Creates a PropertySet instance from an |
| public | PropertySet(final byte[]
The byte array holding the stream data. stream, final int The offset in offset, final int stream where the stream
data begin. If the stream data begin with the first byte in the
array, the offset is 0.The length of the stream data. length)Creates a PropertySet instance from a byte array that represents a stream in the Horrible Property Set Format. |
| public | PropertySet(final byte[]
The byte array holding the stream data. The
complete byte array contents is the stream data. stream)Creates a PropertySet instance from a byte array that represents a stream in the Horrible Property Set Format. |
| public | PropertySet(PropertySet
The property set to copy ps)Constructs a |
| Modifier and Type | Method and Description |
|---|---|
| public void | addSection(final Section
The section)Section to add. It will be appended
after any sections that are already present in the property set
and thus become the last section.Adds a section to this property set. |
| public void | |
| public boolean | Returns: true if the objects are equal, false
if notthe object to compare this o)PropertySet withOverrides java. Returns |
| public int | |
| public ClassID | |
| public Section | |
| public int | |
| public int | |
| public Property[] | Returns: The properties of the onlySection of this
PropertySet.Convenience method returning the |
| protected Object | Returns: The property valueThe property ID id)Convenience method returning the value of the property with the specified ID.
If the property is not available, |
| pack-priv boolean | Returns: The property valueThe property ID id)Convenience method returning the value of a boolean property with the
specified ID. If the property is not available, |
| pack-priv int | Returns: The propertyIntValue valueThe property ID id)Convenience method returning the value of the numeric property with the specified ID. If the property is not available, 0 is returned. |
| public PropertyIDMap | Returns: the id to name mapping of the properties in this set ornull if not applicableThe id to name mapping of the properties in this set. |
| pack-priv String | Returns: The property as a String, or null if unavailablethe property id propertyId)Fetches the property with the given ID, then does its best to return it as a String |
| public static String | Returns: The property value as a String, or null if unavailablethe property value propertyValue)Return the string representation of a property value |
| public int | |
| public List | |
| public int | |
| private void | init(final byte[]
Byte array containing the property set stream src, final int The property set stream starts at this offset
from the beginning of offset, final int srcLength of the property set stream. length)Initializes this PropertySet instance from a byte array. |
| public boolean | Returns: true if this PropertySet
represents a Document Summary Information, else false.Checks whether this PropertySet is a Document Summary Information. |
| public static boolean | Returns: true if the stream is a property set
stream, else false.The stream)InputStream to check. In order to
perform the check, the method reads the first bytes from the
stream. After reading, the stream is reset to the position it
had before reading. The InputStream must support the
InputStream#mark method.Checks whether an |
| public static boolean | Returns: true if the byte array is a property set
stream, false if not.The byte array to check. src, final int The offset in the byte array. offset, final int The significant number of bytes in the byte
array. Only this number of bytes will be checked. length)Checks whether a byte array is in the Horrible Property Set Format. |
| public boolean | Returns: true if this PropertySet
represents a Summary Information, else false.Checks whether this PropertySet represents a Summary Information. |
| pack-priv static boolean | |
| private static void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public void | setByteOrder(int
The property set stream's low-level "byte order" field. byteOrder)Returns the property set stream's low-level "byte order" field. |
| public void | setClassID(ClassID
The property set stream's low-level "class ID" field. classID)Sets the property set stream's low-level "class ID" field. |
| public void | setFormat(int
The property set stream's low-level "format" field. format)Sets the property set stream's low-level "format" field. |
| public void | setOSVersion(int
The property set stream's low-level "OS version" field. osVersion)Sets the property set stream's low-level "OS version" field. |
| private byte[] | |
| public InputStream | Returns: the contents of this property set streamReturns the contents of this property set stream as an input stream. |
| public String | |
| public boolean | Returns: true if the last call to getPropertyIntValue or getProperty tried to access a
property that was not available, else false.Checks whether the property which the last call to |
| public void | write(final OutputStream
the output stream to write the section to out)Writes the property set to an output stream. |
| public void | write(final DirectoryEntry
The directory in the POI filesystem to write the document to. dir, final String The document's name. If there is already a document with the
same name in the directory the latter will be overwritten. name)Writes a property set to a document in a POI filesystem directory. |
| BYTE_ORDER_ASSERTION | back to summary |
|---|---|
| pack-priv static final int BYTE_ORDER_ASSERTION The "byteOrder" field must equal this value. | |
| byteOrder | back to summary |
|---|---|
| private int byteOrder Specifies this | |
| classID | back to summary |
|---|---|
| private ClassID classID Specifies this | |
| format | back to summary |
|---|---|
| private int format Specifies this | |
| FORMAT_ASSERTION | back to summary |
|---|---|
| pack-priv static final int FORMAT_ASSERTION The "format" field must equal this value. | |
| OFFSET_HEADER | back to summary |
|---|---|
| pack-priv static final int OFFSET_HEADER The length of the property set stream header. | |
| OS_MACINTOSH | back to summary |
|---|---|
| public static final int OS_MACINTOSH If the OS version field holds this value the property set stream was created on a Macintosh system. | |
| OS_WIN16 | back to summary |
|---|---|
| public static final int OS_WIN16 If the OS version field holds this value the property set stream was created on a 16-bit Windows system. | |
| OS_WIN32 | back to summary |
|---|---|
| public static final int OS_WIN32 If the OS version field holds this value the property set stream was created on a 32-bit Windows system. | |
| osVersion | back to summary |
|---|---|
| private int osVersion Specifies the version of the operating system that created this
| |
| sections | back to summary |
|---|---|
| private final List<Section> sections The sections in this | |
| PropertySet | back to summary |
|---|---|
| public PropertySet() Constructs a | |
| PropertySet | back to summary |
|---|---|
| public PropertySet(final InputStream stream) throws NoPropertySetStreamException, IOException Creates a PropertySet instance from an The constructor reads the first few bytes from the stream and determines whether it is really a property set stream. If it is, it parses the rest of the stream. If it is not, it resets the stream to its beginning in order to let other components mess around with the data and throws an exception.
| |
| PropertySet | back to summary |
|---|---|
| public PropertySet(final byte[] stream, final int offset, final int length) throws NoPropertySetStreamException, UnsupportedEncodingException Creates a PropertySet instance from a byte array that represents a stream in the Horrible Property Set Format.
| |
| PropertySet | back to summary |
|---|---|
| public PropertySet(final byte[] stream) throws NoPropertySetStreamException, UnsupportedEncodingException Creates a PropertySet instance from a byte array that represents a stream in the Horrible Property Set Format.
| |
| PropertySet | back to summary |
|---|---|
| public PropertySet(PropertySet ps) Constructs a
| |
| addSection | back to summary |
|---|---|
| public void addSection(final Section section) Adds a section to this property set. | |
| clearSections | back to summary |
|---|---|
| public void clearSections() Removes all sections from this property set. | |
| equals | back to summary |
|---|---|
| public boolean equals(final Object o) Overrides java. Returns | |
| getByteOrder | back to summary |
|---|---|
public int getByteOrder()
| |
| getClassID | back to summary |
|---|---|
public ClassID getClassID()
| |
| getFirstSection | back to summary |
|---|---|
| public Section getFirstSection() Gets the PropertySets first section.
| |
| getFormat | back to summary |
|---|---|
public int getFormat()
| |
| getOSVersion | back to summary |
|---|---|
public int getOSVersion()
| |
| getProperties | back to summary |
|---|---|
| public Property[] getProperties() throws NoSingleSectionException Convenience method returning the
| |
| getProperty | back to summary |
|---|---|
| protected Object getProperty(final int id) throws NoSingleSectionException Convenience method returning the value of the property with the specified ID.
If the property is not available,
| |
| getPropertyBooleanValue | back to summary |
|---|---|
| pack-priv boolean getPropertyBooleanValue(final int id) throws NoSingleSectionException Convenience method returning the value of a boolean property with the
specified ID. If the property is not available,
| |
| getPropertyIntValue | back to summary |
|---|---|
| pack-priv int getPropertyIntValue(final int id) throws NoSingleSectionException Convenience 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
| |
| getPropertySetIDMap | back to summary |
|---|---|
| public PropertyIDMap getPropertySetIDMap() The id to name mapping of the properties in this set.
| |
| getPropertyStringValue | back to summary |
|---|---|
| pack-priv String getPropertyStringValue(final int propertyId) Fetches the property with the given ID, then does its best to return it as a String
| |
| getPropertyStringValue | back to summary |
|---|---|
| public static String getPropertyStringValue(final Object propertyValue) Return the string representation of a property value | |
| getSectionCount | back to summary |
|---|---|
public int getSectionCount()
| |
| getSections | back to summary |
|---|---|
| public List | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| init | back to summary |
|---|---|
| private void init(final byte[] src, final int offset, final int length) throws UnsupportedEncodingException Initializes this PropertySet instance from a byte array. The method assumes that it has been checked already that the byte array indeed represents a property set stream. It does no more checks on its own.
| |
| isDocumentSummaryInformation | back to summary |
|---|---|
| public boolean isDocumentSummaryInformation() Checks whether this PropertySet is a Document Summary Information.
| |
| isPropertySetStream | back to summary |
|---|---|
| public static boolean isPropertySetStream(final InputStream stream) throws IOException Checks whether an
| |
| isPropertySetStream | back to summary |
|---|---|
| public static boolean isPropertySetStream(final byte[] src, final int offset, final int length) Checks whether a byte array is in the Horrible Property Set Format.
| |
| isSummaryInformation | back to summary |
|---|---|
| public boolean isSummaryInformation() Checks whether this PropertySet represents a Summary Information.
| |
| matchesSummary | back to summary |
|---|---|
| pack-priv static boolean matchesSummary(ClassID actual, ClassID... expected) | |
| putClassId | back to summary |
|---|---|
| private static void putClassId(final UnsynchronizedByteArrayOutputStream out, final ClassID n) | |
| remove1stProperty | back to summary |
|---|---|
| pack-priv void remove1stProperty(long id) | |
| set1stProperty | back to summary |
|---|---|
| pack-priv void set1stProperty(long id, String value) | |
| set1stProperty | back to summary |
|---|---|
| pack-priv void set1stProperty(long id, int value) | |
| set1stProperty | back to summary |
|---|---|
| pack-priv void set1stProperty(long id, boolean value) | |
| set1stProperty | back to summary |
|---|---|
pack-priv void set1stProperty(long id, byte[] value)
| |
| setByteOrder | back to summary |
|---|---|
| public void setByteOrder(int byteOrder) Returns the property set stream's low-level "byte order" field.
| |
| setClassID | back to summary |
|---|---|
| public void setClassID(ClassID classID) Sets the property set stream's low-level "class ID" field.
| |
| setFormat | back to summary |
|---|---|
| public void setFormat(int format) Sets the property set stream's low-level "format" field.
| |
| setOSVersion | back to summary |
|---|---|
| public void setOSVersion(int osVersion) Sets the property set stream's low-level "OS version" field.
| |
| toBytes | back to summary |
|---|---|
| private byte[] toBytes() throws WritingNotSupportedException, IOException | |
| toInputStream | back to summary |
|---|---|
| public InputStream toInputStream() throws WritingNotSupportedException, IOException Returns 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 PropertySet only.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| wasNull | back to summary |
|---|---|
| public boolean wasNull() throws NoSingleSectionException Checks whether the property which the last call to
| |
| write | back to summary |
|---|---|
| public void write(final OutputStream out) throws IOException, WritingNotSupportedException Writes the property set to an output stream.
| |
| write | back to summary |
|---|---|
| public void write(final DirectoryEntry dir, final String name) throws WritingNotSupportedException, IOException Writes a property set to a document in a POI filesystem directory.
| |