public class Section
extends java.lang.Object
PropertySet
.
(表示 PropertySet 中的一个部分。)
Constructor and Description |
---|
Section()
Creates an empty
Section .
|
Section(byte[] src, int offset)
Creates a
Section instance from a byte array.
|
Section(Section s)
Constructs a
Section by doing a deep copy of an existing
Section .
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all properties from the section including 0 (dictionary) and 1 (codepage).
(从该部分中删除所有属性,包括 0(字典)和 1(代码页)。)
|
boolean |
equals(java.lang.Object o)
Checks whether this section is equal to another object.
(检查此部分是否等于另一个对象。)
|
int |
getCodepage()
Gets the section's codepage, if any.
(获取节的代码页(如果有)。)
|
java.util.Map<java.lang.Long,java.lang.String> |
getDictionary()
Gets the section's dictionary.
(获取节的字典。)
|
ClassID |
getFormatID()
Returns the format ID.
(返回格式 ID。)
|
long |
getOffset()
Returns the offset of the section in the stream.
(返回流中部分的偏移量。)
|
java.lang.String |
getPIDString(long pid)
Returns the PID string associated with a property ID.
(返回与属性 ID 关联的 PID 字符串。)
|
Property[] |
getProperties()
Returns this section's properties.
(返回此部分的属性。)
|
java.lang.Object |
getProperty(long id)
Returns the value of the property with the specified ID.
(返回具有指定 ID 的属性的值。)
|
int |
getPropertyCount()
Returns the number of properties in this section.
(返回此部分中的属性数。)
|
int |
getSize() |
int |
hashCode() |
void |
removeProperty(long id)
Removes a property.
(删除一个属性。)
|
void |
setCodepage(int codepage)
Sets the codepage.
(设置代码页。)
|
void |
setDictionary(java.util.Map<java.lang.Long,java.lang.String> dictionary)
Sets the section's dictionary.
(设置部分的字典。)
|
void |
setFormatID(byte[] formatID)
Sets the section's format ID.
(设置部分的格式 ID。)
|
void |
setFormatID(ClassID formatID)
Sets the section's format ID.
(设置部分的格式 ID。)
|
void |
setProperties(Property[] properties)
Sets this section's properties.
(设置此部分的属性。)
|
void |
setProperty(int id, boolean value)
Sets the boolean value of the property with the specified ID.
(设置具有指定 ID 的属性的布尔值。)
|
void |
setProperty(int id, int value)
Sets the int value of the property with the specified ID.
(设置具有指定 ID 的属性的 int 值。)
|
void |
setProperty(int id, long value)
Sets the long value of the property with the specified ID.
(设置具有指定 ID 的属性的长值。)
|
void |
setProperty(int id, long variantType, java.lang.Object value)
Sets the value and the variant type of the property with the specified ID.
(设置具有指定 ID 的属性的值和变体类型。)
|
void |
setProperty(int id, java.lang.Object value)
Sets a property.
(设置一个属性。)
|
void |
setProperty(int id, java.lang.String value)
Sets the string value of the property with the specified ID.
(设置具有指定 ID 的属性的字符串值。)
|
void |
setProperty(Property p)
Sets a property.
(设置一个属性。)
|
protected void |
setPropertyBooleanValue(int id, boolean value)
Sets the value of the boolean property with the specified ID.
(设置具有指定 ID 的布尔属性的值。)
|
java.lang.String |
toString() |
java.lang.String |
toString(PropertyIDMap idMap) |
boolean |
wasNull()
Checks whether the property which the last call to
getPropertyIntValue(long) or
getProperty(long) tried to access was available or not.
(检查最后一次调用 getPropertyIntValue(long) 或 getProperty(long) 尝试访问的属性是否可用。)
|
int |
write(java.io.OutputStream out)
Writes this section into an output stream.
(将此部分写入输出流。)
|
public Section()
Section
.
(创建一个空部分。)
public Section(Section s)
Section
by doing a deep copy of an existing
Section
. All nested
Property
instances, will be their mutable counterparts in the new
MutableSection
.
(通过对现有 Section 进行深层复制来构造 Section。所有嵌套的 Property 实例都将成为新 MutableSection 中的可变对应物。)
s
- The section set to copy
(s - 要复制的部分)
public Section(byte[] src, int offset) throws java.io.UnsupportedEncodingException
Section
instance from a byte array.
(从字节数组创建 Section 实例。)
src
- Contains the complete property set stream.
(src - 包含完整的属性集流。)
offset
- The position in the stream that points to the section's format ID.
(offset - 流中指向节的格式 ID 的位置。)
java.io.UnsupportedEncodingException
- if the section's codepage is not supported.
(java.io.UnsupportedEncodingException - 如果不支持该部分的代码页。)
public ClassID getFormatID()
Section
contains the bytes specified by
org.apache.poi.hpsf.wellknown.SectionIDMap.SUMMARY_INFORMATION_ID
the section (and thus the property set) is a SummaryInformation.
(返回格式 ID。格式 ID 是节的“类型”。例如,如果第一个部分的格式 ID 包含由 org.apache.poi.hpsf.wellknown.SectionIDMap.SUMMARY_INFORMATION_ID 指定的字节,则该部分(以及属性集)是一个 SummaryInformation。)
public void setFormatID(ClassID formatID)
formatID
- The section's format ID
(formatID - 部分的格式 ID)
public void setFormatID(byte[] formatID)
formatID
- The section's format ID as a byte array. It components are in big-endian format.
(formatID - 节的格式 ID 作为字节数组。它的组件采用大端格式。)
public long getOffset()
public int getPropertyCount()
public Property[] getProperties()
public void setProperties(Property[] properties)
properties
- This section's new properties.
(properties - 本节的新属性。)
public java.lang.Object getProperty(long id)
null
is returned and a subsequent call to
wasNull
will return
true
.
(返回具有指定 ID 的属性的值。如果该属性不可用,则返回 null,随后对 wasNull 的调用将返回 true。)
id
- The property's ID
(id - 属性的 ID)
public void setProperty(int id, java.lang.String value)
id
- The property's ID
(id - 属性的 ID)
value
- The property's value.
(value - 属性的值。)
public void setProperty(int id, int value)
id
- The property's ID
(id - 属性的 ID)
value
- The property's value.
(value - 属性的值。)
setProperty(int, long, Object)
,
getProperty(long)
public void setProperty(int id, long value)
id
- The property's ID
(id - 属性的 ID)
value
- The property's value.
(value - 属性的值。)
setProperty(int, long, Object)
,
getProperty(long)
public void setProperty(int id, boolean value)
id
- The property's ID
(id - 属性的 ID)
value
- The property's value.
(value - 属性的值。)
setProperty(int, long, Object)
,
getProperty(long)
public void setProperty(int id, long variantType, java.lang.Object value)
id
- The property's ID.
(id - 属性的 ID。)
variantType
- The property's variant type.
(variantType - 属性的变体类型。)
value
- The property's value.
(value - 属性的值。)
setProperty(int, String)
,
getProperty(long)
,
Variant
public void setProperty(Property p)
p
- The property to be set.
(p - 要设置的属性。)
setProperty(int, long, Object)
,
getProperty(long)
,
Variant
public void setProperty(int id, java.lang.Object value)
id
- The property ID.
(id - 属性 ID。)
value
- The property's value. The value's class must be one of those supported by HPSF.
(value - 属性的值。值的类必须是 HPSF 支持的类之一。)
protected void setPropertyBooleanValue(int id, boolean value)
id
- The property's ID
(id - 属性的 ID)
value
- The property's value
(value - 财产的价值)
setProperty(int, long, Object)
,
getProperty(long)
,
Variant
public int getSize()
public boolean wasNull()
getPropertyIntValue(long)
or
getProperty(long)
tried to access was available or not. This information might be important for callers of
getPropertyIntValue(long)
since the latter returns 0 if the property does not exist. Using
wasNull
the caller can distiguish this case from a property's real value of 0.
(检查最后一次调用 getPropertyIntValue(long) 或 getProperty(long) 尝试访问的属性是否可用。此信息对于 getPropertyIntValue(long) 的调用者可能很重要,因为如果属性不存在,后者将返回 0。使用 wasNull 调用者可以将这种情况与属性的实际值 0 区分开来。)
true
if the last call to
getPropertyIntValue(long)
or
getProperty(long)
tried to access a property that was not available, else
false
.
(如果最后一次调用 getPropertyIntValue(long) 或 getProperty(long) 尝试访问不可用的属性,则为 true,否则为 false。)
public java.lang.String getPIDString(long pid)
Sections
private dictionary. If it is not found there, the property PID string is taken from sections format IDs namespace. If the PID is also undefined there, i.e. it is not well-known,
"[undefined]"
is returned.
(返回与属性 ID 关联的 PID 字符串。 ID 首先在 Sections 私有字典中查找。如果在那里找不到,则属性 PID 字符串取自 section 格式 ID 命名空间。如果 PID 在那里也未定义,即它不是众所周知的,则返回“[undefined]”。)
pid
- The property ID
(pid - 属性 ID)
pid
(与属性 ID pid 关联的众所周知的属性 ID 字符串)
public void clear()
public boolean equals(java.lang.Object o)
false
if one of the the following conditions holds:
Section
. Section
. equals
in class
java.lang.Object
o
- The object to compare this section with
(o - 将此部分与之比较的对象)
true
if the objects are equal,
false
if not
(如果对象相等,则为 true,否则为 false)
public void removeProperty(long id)
id
- The ID of the property to be removed
(id - 要删除的属性的 ID)
public int write(java.io.OutputStream out) throws WritingNotSupportedException, java.io.IOException
Internally this is done by writing into three byte array output streams: one for the properties, one for the property list and one for the section as such. The two former are appended to the latter when they have received all their data.
(将此部分写入输出流。在内部,这是通过写入三个字节数组输出流来完成的:一个用于属性,一个用于属性列表,一个用于节本身。当他们收到所有数据时,将前两个附加到后者。)out
- The stream to write into.
(out - 要写入的流。)
java.io.IOException
- if an I/O error occurs
(java.io.IOException - 如果发生 I/O 错误)
WritingNotSupportedException
- if HPSF does not yet support writing a property's variant type.
(WritingNotSupportedException - 如果 HPSF 还不支持写入属性的变体类型。)
public void setDictionary(java.util.Map<java.lang.Long,java.lang.String> dictionary) throws IllegalPropertySetDataException
Long
instances, all values must be
String
s. This method overwrites the properties with IDs 0 and 1 since they are reserved for the dictionary and the dictionary's codepage. Setting these properties explicitly might have surprising effects. An application should never do this but always use this method.
(设置部分的字典。字典中的所有键都必须是 Long 实例,所有值都必须是字符串。此方法会覆盖 ID 为 0 和 1 的属性,因为它们是为字典和字典的代码页保留的。明确设置这些属性可能会产生令人惊讶的效果。应用程序永远不应这样做,而应始终使用此方法。)
dictionary
- The dictionary
(字典 - 字典)
IllegalPropertySetDataException
- if the dictionary's key and value types are not correct.
(IllegalPropertySetDataException - 如果字典的键和值类型不正确。)
getDictionary()
public int hashCode()
hashCode
in class
java.lang.Object
Object.hashCode()
public java.lang.String toString()
toString
in class
java.lang.Object
Object.toString()
public java.lang.String toString(PropertyIDMap idMap)
public java.util.Map<java.lang.Long,java.lang.String> getDictionary()
null
if the section does not have a dictionary.
(字典或 null 如果该部分没有字典。)
public int getCodepage()
public void setCodepage(int codepage)
codepage
- the codepage
(代码页 - 代码页)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.