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

EscherBlipRecord

public class EscherBlipRecord extends EscherRecord
author
Glen Stampoultzis
version
$Id: EscherBlipRecord.java 489730 2006-12-22 19:18:16Z bayard $

Fields Summary
public static final short
RECORD_ID_START
public static final short
RECORD_ID_END
public static final String
RECORD_DESCRIPTION
private static final int
HEADER_SIZE
protected byte[]
field_pictureData
Constructors Summary
public EscherBlipRecord()


     
    
    
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 bytesAfterHeader = readHeader( data, offset );
        int pos              = offset + HEADER_SIZE;

        field_pictureData = new byte[bytesAfterHeader];
        System.arraycopy(data, pos, field_pictureData, 0, bytesAfterHeader);

        return bytesAfterHeader + 8;
    
public java.lang.StringgetRecordName()
The short name for this record

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

return
Number of bytes

        return field_pictureData.length + 4;
    
public intserialize(int offset, byte[] data, org.apache.poi.ddf.EscherSerializationListener listener)
Serializes the record to an existing byte array.

param
offset the offset within the byte array
param
data the data array to serialize to
param
listener a listener for begin and end serialization events. This is useful because the serialization is hierarchical/recursive and sometimes you need to be able break into that.
return
the number of bytes written.

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

        LittleEndian.putShort( data, offset, getOptions() );
        LittleEndian.putShort( data, offset + 2, getRecordId() );

        System.arraycopy( field_pictureData, 0, data, offset + 4, field_pictureData.length );

        listener.afterRecordSerialize(offset + 4 + field_pictureData.length, getRecordId(), field_pictureData.length + 4, this);
        return field_pictureData.length + 4;
    
public java.lang.StringtoString()

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

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