PropertyFactorypublic class PropertyFactory extends Object Factory for turning an array of RawDataBlock instances containing
Proprty data into an array of proper Property objects.
The array produced may be sparse, in that any portion of data that
should correspond to a Property, but which does not map to a proper
Property (i.e., a DirectoryProperty, DocumentProperty, or
RootProperty) will get mapped to a null Property in the array. |
Constructors Summary |
---|
private PropertyFactory()
|
Methods Summary |
---|
static java.util.List | convertToProperties(org.apache.poi.poifs.storage.ListManagedBlock[] blocks)Convert raw data blocks to an array of Property's
List properties = new ArrayList();
for (int j = 0; j < blocks.length; j++)
{
byte[] data = blocks[ j ].getData();
int property_count = data.length
/ POIFSConstants.PROPERTY_SIZE;
int offset = 0;
for (int k = 0; k < property_count; k++)
{
switch (data[ offset + PropertyConstants.PROPERTY_TYPE_OFFSET ])
{
case PropertyConstants.DIRECTORY_TYPE :
properties
.add(new DirectoryProperty(properties.size(),
data, offset));
break;
case PropertyConstants.DOCUMENT_TYPE :
properties.add(new DocumentProperty(properties.size(),
data, offset));
break;
case PropertyConstants.ROOT_TYPE :
properties.add(new RootProperty(properties.size(),
data, offset));
break;
default :
properties.add(null);
break;
}
offset += POIFSConstants.PROPERTY_SIZE;
}
}
return properties;
|
|