Methods Summary |
---|
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;
field_1_blipTypeWin32 = data[pos];
field_2_blipTypeMacOS = data[pos + 1];
System.arraycopy( data, pos + 2, field_3_uid = new byte[16], 0, 16 );
field_4_tag = LittleEndian.getShort( data, pos + 18 );
field_5_size = LittleEndian.getInt( data, pos + 20 );
field_6_ref = LittleEndian.getInt( data, pos + 24 );
field_7_offset = LittleEndian.getInt( data, pos + 28 );
field_8_usage = data[pos + 32];
field_9_name = data[pos + 33];
field_10_unused2 = data[pos + 34];
field_11_unused3 = data[pos + 35];
bytesRemaining -= 36;
int bytesRead = 0;
if (bytesRemaining > 0)
{
field_12_blipRecord = (EscherBlipRecord) recordFactory.createRecord( data, pos + 36 );
bytesRead = field_12_blipRecord.fillFields( data, pos + 36, recordFactory );
}
pos += 36 + bytesRead;
bytesRemaining -= bytesRead;
// if (field_1_blipTypeWin32 == BT_PNG)
// {
// byte[] uid = new byte[16];
// System.arraycopy( data, pos + 36, uid, 0, 16 );
// byte[] puid = new byte[16];
// System.arraycopy( data, pos + 52, puid, 0, 16 );
// byte tag = data[pos+68];
// System.out.println( HexDump.dump( data, 0, 0 ) );
// byte[] pngBytes = EscherBlipRecord.decompress( data, pos+69, bytesRemaining);
// }
remainingData = new byte[bytesRemaining];
System.arraycopy( data, pos, remainingData, 0, bytesRemaining );
return bytesRemaining + 8 + 36 + (field_12_blipRecord == null ? 0 : field_12_blipRecord.getRecordSize()) ;
|
public org.apache.poi.ddf.EscherBlipRecord | getBlipRecord()
return field_12_blipRecord;
|
public java.lang.String | getBlipType(byte b)Retrieve the string representation given a blip id.
switch ( b )
{
case BT_ERROR:
return " ERROR";
case BT_UNKNOWN:
return " UNKNOWN";
case BT_EMF:
return " EMF";
case BT_WMF:
return " WMF";
case BT_PICT:
return " PICT";
case BT_JPEG:
return " JPEG";
case BT_PNG:
return " PNG";
case BT_DIB:
return " DIB";
default:
if ( b < 32 )
return " NotKnown";
else
return " Client";
}
|
public byte | getBlipTypeMacOS()The expected blip type under MacOS (failure to match this blip type will result in
Excel converting to this format).
return field_2_blipTypeMacOS;
|
public byte | getBlipTypeWin32()The expected blip type under windows (failure to match this blip type will result in
Excel converting to this format).
return field_1_blipTypeWin32;
|
public byte | getName()The length in characters of the blip name.
return field_9_name;
|
public int | getOffset()File offset in the delay stream.
return field_7_offset;
|
public java.lang.String | getRecordName()The short name for this record
return "BSE";
|
public int | getRecordSize()Returns the number of bytes that are required to serialize this record.
return 8 + 1 + 1 + 16 + 2 + 4 + 4 + 4 + 1 + 1 + 1 + 1 + field_12_blipRecord.getRecordSize() + (remainingData == null ? 0 : remainingData.length);
|
public int | getRef()The reference count of this blip.
return field_6_ref;
|
public byte[] | getRemainingData()Any remaining data in this record.
return remainingData;
|
public int | getSize()Blip size in stream.
return field_5_size;
|
public short | getTag()unused
return field_4_tag;
|
public byte[] | getUid()16 byte MD4 checksum.
return field_3_uid;
|
public byte | getUnused2()
return field_10_unused2;
|
public byte | getUnused3()
return field_11_unused3;
|
public byte | getUsage()Defines the way this blip is used.
return field_8_usage;
|
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 );
if (remainingData == null)
remainingData = new byte[0];
LittleEndian.putShort( data, offset, getOptions() );
LittleEndian.putShort( data, offset + 2, getRecordId() );
if (remainingData == null) remainingData = new byte[0];
int blipSize = field_12_blipRecord == null ? 0 : field_12_blipRecord.getRecordSize();
int remainingBytes = remainingData.length + 36 + blipSize;
LittleEndian.putInt( data, offset + 4, remainingBytes );
data[offset + 8] = field_1_blipTypeWin32;
data[offset + 9] = field_2_blipTypeMacOS;
for ( int i = 0; i < 16; i++ )
data[offset + 10 + i] = field_3_uid[i];
LittleEndian.putShort( data, offset + 26, field_4_tag );
LittleEndian.putInt( data, offset + 28, field_5_size );
LittleEndian.putInt( data, offset + 32, field_6_ref );
LittleEndian.putInt( data, offset + 36, field_7_offset );
data[offset + 40] = field_8_usage;
data[offset + 41] = field_9_name;
data[offset + 42] = field_10_unused2;
data[offset + 43] = field_11_unused3;
int bytesWritten = 0;
if (field_12_blipRecord != null)
{
bytesWritten = field_12_blipRecord.serialize( offset + 44, data, new NullEscherSerializationListener() );
}
if (remainingData == null)
remainingData = new byte[0];
System.arraycopy( remainingData, 0, data, offset + 44 + bytesWritten, remainingData.length );
int pos = offset + 8 + 36 + remainingData.length + bytesWritten;
listener.afterRecordSerialize(pos, getRecordId(), pos - offset, this);
return pos - offset;
|
public void | setBlipRecord(org.apache.poi.ddf.EscherBlipRecord field_12_blipRecord)
this.field_12_blipRecord = field_12_blipRecord;
|
public void | setBlipTypeMacOS(byte blipTypeMacOS)Set the expected MacOS blip type
this.field_2_blipTypeMacOS = blipTypeMacOS;
|
public void | setBlipTypeWin32(byte blipTypeWin32)Set the expected win32 blip type
this.field_1_blipTypeWin32 = blipTypeWin32;
|
public void | setName(byte name)The length in characters of the blip name.
this.field_9_name = name;
|
public void | setOffset(int offset)File offset in the delay stream.
this.field_7_offset = offset;
|
public void | setRef(int ref)The reference count of this blip.
this.field_6_ref = ref;
|
public void | setRemainingData(byte[] remainingData)Any remaining data in this record.
this.remainingData = remainingData;
|
public void | setSize(int size)Blip size in stream.
this.field_5_size = size;
|
public void | setTag(short tag)unused
this.field_4_tag = tag;
|
public void | setUid(byte[] uid)16 byte MD4 checksum.
this.field_3_uid = uid;
|
public void | setUnused2(byte unused2)
this.field_10_unused2 = unused2;
|
public void | setUnused3(byte unused3)
this.field_11_unused3 = unused3;
|
public void | setUsage(byte usage)Defines the way this blip is used.
this.field_8_usage = usage;
|
public java.lang.String | toString()Calculate the string representation of this object
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 = e.toString();
}
return getClass().getName() + ":" + nl +
" RecordId: 0x" + HexDump.toHex( RECORD_ID ) + nl +
" Options: 0x" + HexDump.toHex( getOptions() ) + nl +
" BlipTypeWin32: " + field_1_blipTypeWin32 + nl +
" BlipTypeMacOS: " + field_2_blipTypeMacOS + nl +
" SUID: " + HexDump.toHex(field_3_uid) + nl +
" Tag: " + field_4_tag + nl +
" Size: " + field_5_size + nl +
" Ref: " + field_6_ref + nl +
" Offset: " + field_7_offset + nl +
" Usage: " + field_8_usage + nl +
" Name: " + field_9_name + nl +
" Unused2: " + field_10_unused2 + nl +
" Unused3: " + field_11_unused3 + nl +
" blipRecord: " + field_12_blipRecord + nl +
" Extra Data:" + nl + extraData;
|