FileDocCategorySizeDatePackage
EscherComplexProperty.javaAPI DocApache Poi 3.0.15243Mon Jan 01 12:39:40 GMT 2007org.apache.poi.ddf

EscherComplexProperty

public class EscherComplexProperty extends EscherProperty
A complex property differs from a simple property in that the data can not fit inside a 32 bit integer. See the specification for more detailed information regarding exactly what is stored here.
author
Glen Stampoultzis

Fields Summary
byte[]
complexData
Constructors Summary
public EscherComplexProperty(short id, byte[] complexData)
Create a complex property using the property id and a byte array containing the complex data value.

param
id The id consists of the property number, a flag indicating whether this is a blip id and a flag indicating that this is a complex property.
param
complexData The value of this property.


                                                                                         
          
    
        super( id );
        this.complexData = complexData;
    
public EscherComplexProperty(short propertyNumber, boolean isBlipId, byte[] complexData)
Create a complex property using the property number, a flag to indicate whether this is a blip reference and the complex property data.

param
propertyNumber The property number
param
isBlipId Whether this is a blip id. Should be false.
param
complexData The value of this complex property.

        super( propertyNumber, true, isBlipId );
        this.complexData = complexData;
    
Methods Summary
public booleanequals(java.lang.Object o)
Determine whether this property is equal to another property.

param
o The object to compare to.
return
True if the objects are equal.

        if ( this == o ) return true;
        if ( !( o instanceof EscherComplexProperty ) ) return false;

        final EscherComplexProperty escherComplexProperty = (EscherComplexProperty) o;

        if ( !Arrays.equals( complexData, escherComplexProperty.complexData ) ) return false;

        return true;
    
public byte[]getComplexData()
Get the complex data value.

        return complexData;
    
public intgetPropertySize()
Caclulates the number of bytes required to serialize this property.

return
Number of bytes

        return 6 + complexData.length;
    
public inthashCode()
Calculates a hashcode for this property.

        return getId() * 11;
    
public intserializeComplexPart(byte[] data, int pos)
Serializes the complex part of this property

param
data The data array to serialize to
param
pos The offset within data to start serializing to.
return
The number of bytes serialized.

        System.arraycopy(complexData, 0, data, pos, complexData.length);
        return complexData.length;
    
public intserializeSimplePart(byte[] data, int pos)
Serializes the simple part of this property. ie the first 6 bytes.

        LittleEndian.putShort(data, pos, getId());
        LittleEndian.putInt(data, pos + 2, complexData.length);
        return 6;
    
public java.lang.StringtoString()
Retrieves the string representation for this property.

        String dataStr;
        ByteArrayOutputStream b = new ByteArrayOutputStream();
        try
        {
            HexDump.dump( this.complexData, 0, b, 0 );
            dataStr = b.toString();
        }
        catch ( Exception e )
        {
            dataStr = e.toString();
        }
        finally
        {
            try
            {
                b.close();
            }
            catch ( IOException e )
            {
                e.printStackTrace();
            }
        }

        return "propNum: " + getPropertyNumber()
                + ", propName: " + EscherProperties.getPropertyName( getPropertyNumber() )
                + ", complex: " + isComplex()
                + ", blipId: " + isBlipId()
                + ", data: " + System.getProperty("line.separator") + dataStr;