public class MutablePropertySet extends PropertySet
Adds writing support to the PropertySet
class.
Please be aware that this class' functionality will be merged into the
PropertySet
class at a later time, so the API will change.
byteOrder, classID, format, OS_MACINTOSH, OS_WIN16, OS_WIN32, osVersion, sections
Constructor and Description |
---|
MutablePropertySet()
Constructs a
MutablePropertySet instance. |
MutablePropertySet(PropertySet ps)
Constructs a
MutablePropertySet by doing a deep copy of
an existing PropertySet . |
Modifier and Type | Method and Description |
---|---|
void |
addSection(Section section)
Adds a section to this property set.
|
void |
clearSections()
Removes all sections from this property set.
|
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.
|
InputStream |
toInputStream()
Returns the contents of this property set stream as an input stream.
|
void |
write(DirectoryEntry dir,
String name)
Writes a property set to a document in a POI filesystem directory.
|
void |
write(OutputStream out)
Writes the property set to an output stream.
|
equals, getByteOrder, getClassID, getFirstSection, getFormat, getOSVersion, getProperties, getProperty, getPropertyBooleanValue, getPropertyIntValue, getSectionCount, getSections, getSingleSection, hashCode, isDocumentSummaryInformation, isPropertySetStream, isPropertySetStream, isSummaryInformation, toString, wasNull
public MutablePropertySet()
Constructs a MutablePropertySet
instance. Its
primary task is to initialize the immutable field with their proper
values. It also sets fields that might change to reasonable defaults.
public MutablePropertySet(PropertySet ps)
Constructs a MutablePropertySet
by doing a deep copy of
an existing PropertySet
. All nested elements, i.e.
Section
s and Property
instances, will be their
mutable counterparts in the new MutablePropertySet
.
ps
- The property set to copypublic void setByteOrder(int byteOrder)
Sets the "byteOrder" property.
byteOrder
- the byteOrder value to setpublic void setFormat(int format)
Sets the "format" property.
format
- the format value to setpublic void setOSVersion(int osVersion)
Sets the "osVersion" property.
osVersion
- the osVersion value to setpublic void setClassID(ClassID classID)
Sets the property set stream's low-level "class ID" field.
classID
- The property set stream's low-level "class ID" field.PropertySet.getClassID()
public void clearSections()
Removes all sections from this property set.
public void addSection(Section section)
Adds a section to this property set.
section
- 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.public void write(OutputStream out) throws WritingNotSupportedException, IOException
Writes the property set to an output stream.
out
- the output stream to write the section toIOException
- if an error when writing to the output stream
occursWritingNotSupportedException
- if HPSF does not yet support
writing a property's variant type.public InputStream toInputStream() throws IOException, WritingNotSupportedException
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 MutablePropertySet
only.
WritingNotSupportedException
- if HPSF does not yet support writing
of a property's variant type.IOException
- if an I/O exception occurs.public void write(DirectoryEntry dir, String name) throws WritingNotSupportedException, IOException
Writes a property set to a document in a POI filesystem directory.
dir
- 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
IOException
Copyright © 2020. All rights reserved.