Methods Summary |
---|
public void | addEscherProperty(org.apache.poi.ddf.EscherProperty prop)Add a property to this record.
properties.add( prop );
|
public int | fillFields(byte[] data, int offset, org.apache.poi.ddf.EscherRecordFactory recordFactory)This method deserializes the record from a byte array.
int bytesRemaining = readHeader( data, offset );
int pos = offset + 8;
EscherPropertyFactory f = new EscherPropertyFactory();
properties = f.createProperties( data, pos, getInstance() );
return bytesRemaining + 8;
|
public java.util.List | getEscherProperties()The list of properties stored by this record.
return properties;
|
public org.apache.poi.ddf.EscherProperty | getEscherProperty(int index)The list of properties stored by this record.
return (EscherProperty) properties.get( index );
|
public short | getOptions()Automatically recalculate the correct option
setOptions( (short) ( ( properties.size() << 4 ) | 0x3 ) );
return super.getOptions();
|
private int | getPropertiesSize()
int totalSize = 0;
for ( Iterator iterator = properties.iterator(); iterator.hasNext(); )
{
EscherProperty escherProperty = (EscherProperty) iterator.next();
totalSize += escherProperty.getPropertySize();
}
return totalSize;
|
public java.lang.String | getRecordName()The short name for this record
return "Opt";
|
public int | getRecordSize()Returns the number of bytes that are required to serialize this record.
return 8 + getPropertiesSize();
|
public int | serialize(int offset, byte[] data, org.apache.poi.ddf.EscherSerializationListener listener)This method serializes this escher record into a byte array.
listener.beforeRecordSerialize( offset, getRecordId(), this );
LittleEndian.putShort( data, offset, getOptions() );
LittleEndian.putShort( data, offset + 2, getRecordId() );
LittleEndian.putInt( data, offset + 4, getPropertiesSize() );
int pos = offset + 8;
for ( Iterator iterator = properties.iterator(); iterator.hasNext(); )
{
EscherProperty escherProperty = (EscherProperty) iterator.next();
pos += escherProperty.serializeSimplePart( data, pos );
}
for ( Iterator iterator = properties.iterator(); iterator.hasNext(); )
{
EscherProperty escherProperty = (EscherProperty) iterator.next();
pos += escherProperty.serializeComplexPart( data, pos );
}
listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );
return pos - offset;
|
public void | sortProperties()Records should be sorted by property number before being stored.
Collections.sort( properties, new Comparator()
{
public int compare( Object o1, Object o2 )
{
EscherProperty p1 = (EscherProperty) o1;
EscherProperty p2 = (EscherProperty) o2;
return new Short( p1.getPropertyNumber() ).compareTo( new Short( p2.getPropertyNumber() ) );
}
} );
|
public java.lang.String | toString()Retrieve the string representation of this record.
String nl = System.getProperty( "line.separator" );
StringBuffer propertiesBuf = new StringBuffer();
for ( Iterator iterator = properties.iterator(); iterator.hasNext(); )
propertiesBuf.append( " "
+ iterator.next().toString()
+ nl );
return "org.apache.poi.ddf.EscherOptRecord:" + nl +
" isContainer: " + isContainerRecord() + nl +
" options: 0x" + HexDump.toHex( getOptions() ) + nl +
" recordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
" numchildren: " + getChildRecords().size() + nl +
" properties:" + nl +
propertiesBuf.toString();
|