org.apache.poi.hpsf
Class Section

java.lang.Object
  |
  +--org.apache.poi.hpsf.Section

public class Section
extends java.lang.Object

Represents a section in a PropertySet.

Since:
2002-02-09
Version:
$Id: Section.java,v 1.6 2002/05/19 18:09:26 acoliver Exp $
Author:
Rainer Klute (klute@rainer-klute.de), Drew Varner (Drew.Varner allUpIn sc.edu)

Field Summary
protected  java.util.Map dictionary
           Maps property IDs to section-private PID strings.
 
Constructor Summary
Section(byte[] src, int offset)
           Creates a Section instance from a byte array.
 
Method Summary
 ClassID getFormatID()
           Returns the format ID.
 long getOffset()
           Returns the offset of the section in the stream.
 java.lang.String getPIDString(int pid)
           Returns the PID string associated with a property ID.
 Property[] getProperties()
           Returns this section's properties.
protected  java.lang.Object getProperty(int id)
           Returns the value of the property with the specified ID.
protected  boolean getPropertyBooleanValue(int id)
           Returns the value of the boolean property with the specified ID.
 int getPropertyCount()
           Returns the number of properties in this section.
protected  int getPropertyIntValue(int id)
           Returns the value of the numeric property with the specified ID.
 int getSize()
           Returns the section's size in bytes.
 boolean wasNull()
           Checks whether the property which the last call to getPropertyIntValue(int) or getProperty(int) tried to access was available or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dictionary

protected java.util.Map dictionary

Maps property IDs to section-private PID strings. These strings can be found in the property with ID 0.

Constructor Detail

Section

public Section(byte[] src,
               int offset)

Creates a Section instance from a byte array.

Parameters:
src - Contains the complete property set stream.
offset - The position in the stream that points to the section's format ID.
Method Detail

getFormatID

public ClassID getFormatID()

Returns the format ID. The format ID is the "type" of the section.

Returns:
The formatID value

getOffset

public long getOffset()

Returns the offset of the section in the stream.

Returns:
The offset value

getSize

public int getSize()

Returns the section's size in bytes.

Returns:
The size value

getPropertyCount

public int getPropertyCount()

Returns the number of properties in this section.

Returns:
The propertyCount value

getProperties

public Property[] getProperties()

Returns this section's properties.

Returns:
The properties value

getProperty

protected java.lang.Object getProperty(int id)

Returns the value of the property with the specified ID. If the property is not available, null is returned and a subsequent call to wasNull() will return true.

Parameters:
id - Description of the Parameter
Returns:
The property value

getPropertyIntValue

protected int getPropertyIntValue(int id)

Returns the value of the numeric property with the specified ID. If the property is not available, 0 is returned. A subsequent call to wasNull() will return true to let the caller distinguish that case from a real property value of 0.

Parameters:
id - Description of the Parameter
Returns:
The propertyIntValue value

getPropertyBooleanValue

protected boolean getPropertyBooleanValue(int id)

Returns the value of the boolean property with the specified ID. If the property is not available, false is returned. A subsequent call to wasNull() will return true to let the caller distinguish that case from a real property value of false.

Parameters:
id - Description of the Parameter
Returns:
The propertyBooleanValue value

wasNull

public boolean wasNull()

Checks whether the property which the last call to getPropertyIntValue(int) or getProperty(int) tried to access was available or not. This information might be important for callers of getPropertyIntValue(int) 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.

Returns:
true if the last call to getPropertyIntValue(int) or getProperty(int) tried to access a property that was not available, else false.

getPIDString

public java.lang.String getPIDString(int pid)

Returns the PID string associated with a property ID. The ID is first looked up in the Section's private dictionary. If it is not found there, the method calls SectionIDMap.getPIDString(byte[], int).

Parameters:
pid - Description of the Parameter
Returns:
The pIDString value

jakarta-poi 1.7.0-dev

Copyright © 2002 Apache jakarta-poi project. All Rights Reserved.