Class Property
java.lang.Object
org.docx4j.org.apache.poi.poifs.property.Property
- All Implemented Interfaces:
POIFSViewable,Child
- Direct Known Subclasses:
DirectoryProperty,DocumentProperty
This abstract base class is the ancestor of all classes
implementing POIFS Property behavior.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate IntegerFieldprivate static final intprivate IntegerFieldprivate static final intprivate IntegerFieldprivate static final intprivate static final byteprivate intprivate static final intprivate Stringprivate ShortFieldprivate static final intprivate Childprivate IntegerFieldprivate static final intprotected static final intprotected static final byteprivate ByteFieldprivate static final intprotected static final byteprivate Childprivate IntegerFieldprivate static final intprivate ByteFieldprivate byte[]private IntegerFieldprivate static final intprivate IntegerFieldprivate static final intprivate IntegerFieldprivate static final intprivate IntegerFieldprivate static final intprivate ClassIDprivate static final intprivate IntegerFieldprivate static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intGet the child property (its index in the Property Table)protected intgetIndex()get the index for this PropertygetName()Get the name of this propertyGet the next Child, if any(package private) intget the next siblingGet the previous Child, if any(package private) intget the previous siblingProvides a short description of the object, to be used when a POIFSViewable object has not provided its contents.intgetSize()find out the document sizeintSets the storage clsid, which is the Class ID of a COM object which reads and writes this streamObject[]Get an array of objects, some of which may implement POIFSViewableGet an Iterator of objects, some of which may implement POIFSViewableabstract booleanstatic booleanisSmall(int length) does the length indicate a small document?(package private) static booleanisValidIndex(int index) determine whether the specified index is validbooleanGive viewers a hint as to whether to call getViewableArray or getViewableIteratorprotected abstract voidpreWrite()Perform whatever activities need to be performed prior to writingprotected voidsetChildProperty(int child) Set the child property.protected voidsetIndex(int index) Set the index for this Propertyprotected voidSet the name; silently truncates the name if it's too long.voidsetNextChild(Child child) Set the next Childprotected voidsetNodeColor(byte nodeColor) Set the node color.voidsetPreviousChild(Child child) Set the previous Childprotected voidsetPropertyType(byte propertyType) Set the property type.protected voidsetSize(int size) Set the size of the document associated with this PropertyvoidsetStartBlock(int startBlock) Set the start block for the document referred to by this Property.voidsetStorageClsid(ClassID clsidStorage) Sets the storage class ID for this property stream.booleanBased on the currently defined size, should this property use small blocks?voidwriteData(OutputStream stream) Write the raw data to an OutputStream.
-
Field Details
-
_default_fill
private static final byte _default_fill- See Also:
-
_name_size_offset
private static final int _name_size_offset- See Also:
-
_max_name_length
private static final int _max_name_length- See Also:
-
_NO_INDEX
protected static final int _NO_INDEX- See Also:
-
_node_color_offset
private static final int _node_color_offset- See Also:
-
_previous_property_offset
private static final int _previous_property_offset- See Also:
-
_next_property_offset
private static final int _next_property_offset- See Also:
-
_child_property_offset
private static final int _child_property_offset- See Also:
-
_storage_clsid_offset
private static final int _storage_clsid_offset- See Also:
-
_user_flags_offset
private static final int _user_flags_offset- See Also:
-
_seconds_1_offset
private static final int _seconds_1_offset- See Also:
-
_days_1_offset
private static final int _days_1_offset- See Also:
-
_seconds_2_offset
private static final int _seconds_2_offset- See Also:
-
_days_2_offset
private static final int _days_2_offset- See Also:
-
_start_block_offset
private static final int _start_block_offset- See Also:
-
_size_offset
private static final int _size_offset- See Also:
-
_NODE_BLACK
protected static final byte _NODE_BLACK- See Also:
-
_NODE_RED
protected static final byte _NODE_RED- See Also:
-
_big_block_minimum_bytes
private static final int _big_block_minimum_bytes- See Also:
-
_name
-
_name_size
-
_property_type
-
_node_color
-
_previous_property
-
_next_property
-
_child_property
-
_storage_clsid
-
_user_flags
-
_seconds_1
-
_days_1
-
_seconds_2
-
_days_2
-
_start_block
-
_size
-
_raw_data
private byte[] _raw_data -
_index
private int _index -
_next_child
-
_previous_child
-
-
Constructor Details
-
Property
protected Property() -
Property
protected Property(int index, byte[] array, int offset) Constructor from byte data- Parameters:
index- index numberarray- byte dataoffset- offset into byte data
-
-
Method Details
-
writeData
Write the raw data to an OutputStream.- Parameters:
stream- the OutputStream to which the data should be written.- Throws:
IOException- on problems writing to the specified stream.
-
setStartBlock
public void setStartBlock(int startBlock) Set the start block for the document referred to by this Property.- Parameters:
startBlock- the start block index
-
getStartBlock
public int getStartBlock()- Returns:
- the start block
-
getSize
public int getSize()find out the document size- Returns:
- size in bytes
-
shouldUseSmallBlocks
public boolean shouldUseSmallBlocks()Based on the currently defined size, should this property use small blocks?- Returns:
- true if the size is less than _big_block_minimum_bytes
-
isSmall
public static boolean isSmall(int length) does the length indicate a small document?- Parameters:
length- length in bytes- Returns:
- true if the length is less than _big_block_minimum_bytes
-
getName
Get the name of this property- Returns:
- property name as String
-
isDirectory
public abstract boolean isDirectory()- Returns:
- true if a directory type Property
-
getStorageClsid
Sets the storage clsid, which is the Class ID of a COM object which reads and writes this stream- Returns:
- storage Class ID for this property stream
-
setName
Set the name; silently truncates the name if it's too long.- Parameters:
name- the new name
-
setStorageClsid
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- Parameters:
clsidStorage- Storage Class ID
-
setPropertyType
protected void setPropertyType(byte propertyType) Set the property type. Makes no attempt to validate the value.- Parameters:
propertyType- the property type (root, file, directory)
-
setNodeColor
protected void setNodeColor(byte nodeColor) Set the node color.- Parameters:
nodeColor- the node color (red or black)
-
setChildProperty
protected void setChildProperty(int child) Set the child property.- Parameters:
child- the child property's index in the Property Table
-
getChildIndex
protected int getChildIndex()Get the child property (its index in the Property Table)- Returns:
- child property index
-
setSize
protected void setSize(int size) Set the size of the document associated with this Property- Parameters:
size- the size of the document, in bytes
-
setIndex
protected void setIndex(int index) Set the index for this Property- Parameters:
index- this Property's index within its containing Property Table
-
getIndex
protected int getIndex()get the index for this Property- Returns:
- the index of this Property within its Property Table
-
preWrite
protected abstract void preWrite()Perform whatever activities need to be performed prior to writing -
getNextChildIndex
int getNextChildIndex()get the next sibling- Returns:
- index of next sibling
-
getPreviousChildIndex
int getPreviousChildIndex()get the previous sibling- Returns:
- index of previous sibling
-
isValidIndex
static boolean isValidIndex(int index) determine whether the specified index is valid- Parameters:
index- value to be checked- Returns:
- true if the index is valid
-
getNextChild
Get the next Child, if any- Specified by:
getNextChildin interfaceChild- Returns:
- the next Child; may return null
-
getPreviousChild
Get the previous Child, if any- Specified by:
getPreviousChildin interfaceChild- Returns:
- the previous Child; may return null
-
setNextChild
Set the next Child- Specified by:
setNextChildin interfaceChild- Parameters:
child- the new 'next' child; may be null, which has the effect of saying there is no 'next' child
-
setPreviousChild
Set the previous Child- Specified by:
setPreviousChildin interfaceChild- Parameters:
child- the new 'previous' child; may be null, which has the effect of saying there is no 'previous' child
-
getViewableArray
Get an array of objects, some of which may implement POIFSViewable- Specified by:
getViewableArrayin interfacePOIFSViewable- Returns:
- an array of Object; may not be null, but may be empty
-
getViewableIterator
Get an Iterator of objects, some of which may implement POIFSViewable- Specified by:
getViewableIteratorin interfacePOIFSViewable- Returns:
- an Iterator; may not be null, but may have an empty back end store
-
preferArray
public boolean preferArray()Give viewers a hint as to whether to call getViewableArray or getViewableIterator- Specified by:
preferArrayin interfacePOIFSViewable- Returns:
- true if a viewer should call getViewableArray, false if a viewer should call getViewableIterator
-
getShortDescription
Provides a short description of the object, to be used when a POIFSViewable object has not provided its contents.- Specified by:
getShortDescriptionin interfacePOIFSViewable- Returns:
- short description
-