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

EscherClientDataRecord

public class EscherClientDataRecord extends EscherRecord
The EscherClientDataRecord is used to store client specific data about the position of a shape within a container.
author
Glen Stampoultzis

Fields Summary
public static final short
RECORD_ID
public static final String
RECORD_DESCRIPTION
private byte[]
remainingData
Constructors Summary
Methods Summary
public intfillFields(byte[] data, int offset, org.apache.poi.ddf.EscherRecordFactory recordFactory)
This method deserializes the record from a byte array.

param
data The byte array containing the escher record information
param
offset The starting offset into data.
param
recordFactory May be null since this is not a container record.
return
The number of bytes read from the byte array.


                                                                         
             
    
        int bytesRemaining = readHeader( data, offset );
        int pos            = offset + 8;
        remainingData  =  new byte[bytesRemaining];
        System.arraycopy( data, pos, remainingData, 0, bytesRemaining );
        return 8 + bytesRemaining;
    
public shortgetRecordId()
Returns the identifier of this record.

        return RECORD_ID;
    
public java.lang.StringgetRecordName()
The short name for this record

        return "ClientData";
    
public intgetRecordSize()
Returns the number of bytes that are required to serialize this record.

return
Number of bytes

        return 8 + (remainingData == null ? 0 : remainingData.length);
    
public byte[]getRemainingData()
Any data recording this record.

        return remainingData;
    
public intserialize(int offset, byte[] data, org.apache.poi.ddf.EscherSerializationListener listener)
This method serializes this escher record into a byte array.

param
offset The offset into data to start writing the record data to.
param
data The byte array to serialize to.
param
listener A listener to retrieve start and end callbacks. Use a NullEscherSerailizationListener to ignore these events.
return
The number of bytes written.
see
NullEscherSerializationListener

        listener.beforeRecordSerialize( offset, getRecordId(), this );

        if (remainingData == null) remainingData = new byte[0];
        LittleEndian.putShort( data, offset, getOptions() );
        LittleEndian.putShort( data, offset + 2, getRecordId() );
        LittleEndian.putInt( data, offset + 4, remainingData.length );
        System.arraycopy( remainingData, 0, data, offset + 8, remainingData.length );
        int pos = offset + 8 + remainingData.length;

        listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );
        return pos - offset;
    
public voidsetRemainingData(byte[] remainingData)
Any data recording this record.

        this.remainingData = remainingData;
    
public java.lang.StringtoString()
Returns the string representation of this record.

        String nl = System.getProperty("line.separator");

        String extraData;
        ByteArrayOutputStream b = new ByteArrayOutputStream();
        try
        {
            HexDump.dump(this.remainingData, 0, b, 0);
            extraData = b.toString();
        }
        catch ( Exception e )
        {
            extraData = "error\n";
        }
        return getClass().getName() + ":" + nl +
                "  RecordId: 0x" + HexDump.toHex(RECORD_ID) + nl +
                "  Options: 0x" + HexDump.toHex(getOptions()) + nl +
                "  Extra Data:" + nl +
                extraData;