Propertypublic abstract class Property extends Object implements POIFSViewable, ChildThis abstract base class is the ancestor of all classes
implementing POIFS Property behavior. |
Fields Summary |
---|
private static final byte | _default_fill | private static final int | _name_size_offset | private static final int | _max_name_length | protected static final int | _NO_INDEX | private static final int | _node_color_offset | private static final int | _previous_property_offset | private static final int | _next_property_offset | private static final int | _child_property_offset | private static final int | _storage_clsid_offset | private static final int | _user_flags_offset | private static final int | _seconds_1_offset | private static final int | _days_1_offset | private static final int | _seconds_2_offset | private static final int | _days_2_offset | private static final int | _start_block_offset | private static final int | _size_offset | protected static final byte | _NODE_BLACK | protected static final byte | _NODE_RED | private static final int | _big_block_minimum_bytes | private String | _name | private ShortField | _name_size | private ByteField | _property_type | private ByteField | _node_color | private IntegerField | _previous_property | private IntegerField | _next_property | private IntegerField | _child_property | private ClassID | _storage_clsid | private IntegerField | _user_flags | private IntegerField | _seconds_1 | private IntegerField | _days_1 | private IntegerField | _seconds_2 | private IntegerField | _days_2 | private IntegerField | _start_block | private IntegerField | _size | private byte[] | _raw_data | private int | _index | private Child | _next_child | private Child | _previous_child |
Constructors Summary |
---|
protected Property()Default constructor
_raw_data = new byte[ POIFSConstants.PROPERTY_SIZE ];
Arrays.fill(_raw_data, _default_fill);
_name_size = new ShortField(_name_size_offset);
_property_type =
new ByteField(PropertyConstants.PROPERTY_TYPE_OFFSET);
_node_color = new ByteField(_node_color_offset);
_previous_property = new IntegerField(_previous_property_offset,
_NO_INDEX, _raw_data);
_next_property = new IntegerField(_next_property_offset,
_NO_INDEX, _raw_data);
_child_property = new IntegerField(_child_property_offset,
_NO_INDEX, _raw_data);
_storage_clsid = new ClassID(_raw_data,_storage_clsid_offset);
_user_flags = new IntegerField(_user_flags_offset, 0, _raw_data);
_seconds_1 = new IntegerField(_seconds_1_offset, 0,
_raw_data);
_days_1 = new IntegerField(_days_1_offset, 0, _raw_data);
_seconds_2 = new IntegerField(_seconds_2_offset, 0,
_raw_data);
_days_2 = new IntegerField(_days_2_offset, 0, _raw_data);
_start_block = new IntegerField(_start_block_offset);
_size = new IntegerField(_size_offset, 0, _raw_data);
_index = _NO_INDEX;
setName("");
setNextChild(null);
setPreviousChild(null);
| protected Property(int index, byte[] array, int offset)Constructor from byte data
_raw_data = new byte[ POIFSConstants.PROPERTY_SIZE ];
System.arraycopy(array, offset, _raw_data, 0,
POIFSConstants.PROPERTY_SIZE);
_name_size = new ShortField(_name_size_offset, _raw_data);
_property_type =
new ByteField(PropertyConstants.PROPERTY_TYPE_OFFSET, _raw_data);
_node_color = new ByteField(_node_color_offset, _raw_data);
_previous_property = new IntegerField(_previous_property_offset,
_raw_data);
_next_property = new IntegerField(_next_property_offset,
_raw_data);
_child_property = new IntegerField(_child_property_offset,
_raw_data);
_storage_clsid = new ClassID(_raw_data,_storage_clsid_offset);
_user_flags = new IntegerField(_user_flags_offset, 0, _raw_data);
_seconds_1 = new IntegerField(_seconds_1_offset, _raw_data);
_days_1 = new IntegerField(_days_1_offset, _raw_data);
_seconds_2 = new IntegerField(_seconds_2_offset, _raw_data);
_days_2 = new IntegerField(_days_2_offset, _raw_data);
_start_block = new IntegerField(_start_block_offset, _raw_data);
_size = new IntegerField(_size_offset, _raw_data);
_index = index;
int name_length = (_name_size.get() / LittleEndianConsts.SHORT_SIZE)
- 1;
if (name_length < 1)
{
_name = "";
}
else
{
char[] char_array = new char[ name_length ];
int name_offset = 0;
for (int j = 0; j < name_length; j++)
{
char_array[ j ] = ( char ) new ShortField(name_offset,
_raw_data).get();
name_offset += LittleEndianConsts.SHORT_SIZE;
}
_name = new String(char_array, 0, name_length);
}
_next_child = null;
_previous_child = null;
|
Methods Summary |
---|
protected int | getChildIndex()Get the child property (its index in the Property Table)
return _child_property.get();
| protected int | getIndex()get the index for this Property
return _index;
| public java.lang.String | getName()Get the name of this property
return _name;
| public org.apache.poi.poifs.property.Child | getNextChild()Get the next Child, if any
return _next_child;
| int | getNextChildIndex()get the next sibling
return _next_property.get();
| public org.apache.poi.poifs.property.Child | getPreviousChild()Get the previous Child, if any
return _previous_child;
| int | getPreviousChildIndex()get the previous sibling
return _previous_property.get();
| public java.lang.String | getShortDescription()Provides a short description of the object, to be used when a
POIFSViewable object has not provided its contents.
StringBuffer buffer = new StringBuffer();
buffer.append("Property: \"").append(getName()).append("\"");
return buffer.toString();
| public int | getSize()find out the document size
return _size.get();
| public int | getStartBlock()
return _start_block.get();
| public org.apache.poi.hpsf.ClassID | getStorageClsid()Sets the storage clsid, which is the Class ID of a COM object which
reads and writes this stream
return _storage_clsid;
| public java.lang.Object[] | getViewableArray()Get an array of objects, some of which may implement
POIFSViewable
Object[] results = new Object[ 5 ];
results[ 0 ] = "Name = \"" + getName() + "\"";
results[ 1 ] = "Property Type = " + _property_type.get();
results[ 2 ] = "Node Color = " + _node_color.get();
long time = _days_1.get();
time <<= 32;
time += (( long ) _seconds_1.get()) & 0x0000FFFFL;
results[ 3 ] = "Time 1 = " + time;
time = _days_2.get();
time <<= 32;
time += (( long ) _seconds_2.get()) & 0x0000FFFFL;
results[ 4 ] = "Time 2 = " + time;
return results;
| public java.util.Iterator | getViewableIterator()Get an Iterator of objects, some of which may implement
POIFSViewable
return Collections.EMPTY_LIST.iterator();
| public abstract boolean | isDirectory()
| public static boolean | isSmall(int length)does the length indicate a small document?
return length < _big_block_minimum_bytes;
| static boolean | isValidIndex(int index)determine whether the specified index is valid
return index != _NO_INDEX;
| protected abstract void | preWrite()Perform whatever activities need to be performed prior to
writing
| public boolean | preferArray()Give viewers a hint as to whether to call getViewableArray or
getViewableIterator
return true;
| protected void | setChildProperty(int child)Set the child property.
_child_property.set(child, _raw_data);
| protected void | setIndex(int index)Set the index for this Property
_index = index;
| protected final void | setName(java.lang.String name)Set the name; silently truncates the name if it's too long.
char[] char_array = name.toCharArray();
int limit = Math.min(char_array.length, _max_name_length);
_name = new String(char_array, 0, limit);
short offset = 0;
int j = 0;
for (; j < limit; j++)
{
new ShortField(offset, ( short ) char_array[ j ], _raw_data);
offset += LittleEndianConsts.SHORT_SIZE;
}
for (; j < _max_name_length + 1; j++)
{
new ShortField(offset, ( short ) 0, _raw_data);
offset += LittleEndianConsts.SHORT_SIZE;
}
// double the count, and include the null at the end
_name_size
.set(( short ) ((limit + 1)
* LittleEndianConsts.SHORT_SIZE), _raw_data);
| public void | setNextChild(org.apache.poi.poifs.property.Child child)Set the next Child
_next_child = child;
_next_property.set((child == null) ? _NO_INDEX
: (( Property ) child)
.getIndex(), _raw_data);
| protected void | setNodeColor(byte nodeColor)Set the node color.
_node_color.set(nodeColor, _raw_data);
| public void | setPreviousChild(org.apache.poi.poifs.property.Child child)Set the previous Child
_previous_child = child;
_previous_property.set((child == null) ? _NO_INDEX
: (( Property ) child)
.getIndex(), _raw_data);
| protected void | setPropertyType(byte propertyType)Set the property type. Makes no attempt to validate the value.
_property_type.set(propertyType, _raw_data);
| protected void | setSize(int size)Set the size of the document associated with this Property
_size.set(size, _raw_data);
| public void | setStartBlock(int startBlock)Set the start block for the document referred to by this
Property.
_start_block.set(startBlock, _raw_data);
| public void | setStorageClsid(org.apache.poi.hpsf.ClassID clsidStorage)Sets the storage class ID for this property stream. This is the Class ID
of the COM object which can read and write this property stream
_storage_clsid = clsidStorage;
if( clsidStorage == null) {
Arrays.fill( _raw_data, _storage_clsid_offset, _storage_clsid_offset + ClassID.LENGTH, (byte) 0);
} else {
clsidStorage.write( _raw_data, _storage_clsid_offset);
}
| public boolean | shouldUseSmallBlocks()Based on the currently defined size, should this property use
small blocks?
return Property.isSmall(_size.get());
| public void | writeData(java.io.OutputStream stream)Write the raw data to an OutputStream.
stream.write(_raw_data);
|
|