UnknownEscherRecordpublic class UnknownEscherRecord extends EscherRecord This record is used whenever a escher record is encountered that
we do not explicitly support. |
Fields Summary |
---|
private static final byte[] | NO_BYTES | private byte[] | thedataThe data for this record not including the the 8 byte header | private List | childRecords |
Constructors Summary |
---|
public UnknownEscherRecord()
|
Methods Summary |
---|
public void | addChildRecord(org.apache.poi.ddf.EscherRecord childRecord)
getChildRecords().add( childRecord );
| public java.lang.Object | clone()
// shallow clone
return super.clone();
| 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 );
if ( isContainerRecord() )
{
int bytesWritten = 0;
thedata = new byte[0];
offset += 8;
bytesWritten += 8;
while ( bytesRemaining > 0 )
{
EscherRecord child = recordFactory.createRecord( data, offset );
int childBytesWritten = child.fillFields( data, offset, recordFactory );
bytesWritten += childBytesWritten;
offset += childBytesWritten;
bytesRemaining -= childBytesWritten;
getChildRecords().add( child );
}
return bytesWritten;
}
else
{
thedata = new byte[bytesRemaining];
System.arraycopy( data, offset + 8, thedata, 0, bytesRemaining );
return bytesRemaining + 8;
}
| public java.util.List | getChildRecords()
return childRecords;
| public byte[] | getData()
return thedata;
| public java.lang.String | getRecordName()The short name for this record
return "Unknown 0x" + HexDump.toHex(getRecordId());
| public int | getRecordSize()Returns the number of bytes that are required to serialize this record.
return 8 + thedata.length;
| public int | serialize(int offset, byte[] data, org.apache.poi.ddf.EscherSerializationListener listener)Writes this record and any contained records to the supplied byte
array.
listener.beforeRecordSerialize( offset, getRecordId(), this );
LittleEndian.putShort(data, offset, getOptions());
LittleEndian.putShort(data, offset+2, getRecordId());
int remainingBytes = thedata.length;
for ( Iterator iterator = getChildRecords().iterator(); iterator.hasNext(); )
{
EscherRecord r = (EscherRecord) iterator.next();
remainingBytes += r.getRecordSize();
}
LittleEndian.putInt(data, offset+4, remainingBytes);
System.arraycopy(thedata, 0, data, offset+8, thedata.length);
int pos = offset+8+thedata.length;
for ( Iterator iterator = getChildRecords().iterator(); iterator.hasNext(); )
{
EscherRecord r = (EscherRecord) iterator.next();
pos += r.serialize(pos, data, listener );
}
listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );
return pos - offset;
| public void | setChildRecords(java.util.List childRecords)
this.childRecords = childRecords;
| public java.lang.String | toString()
String nl = System.getProperty( "line.separator" );
StringBuffer children = new StringBuffer();
if ( getChildRecords().size() > 0 )
{
children.append( " children: " + nl );
for ( Iterator iterator = getChildRecords().iterator(); iterator.hasNext(); )
{
EscherRecord record = (EscherRecord) iterator.next();
children.append( record.toString() );
children.append( nl );
}
}
String theDumpHex = "";
try
{
if (thedata.length != 0)
{
theDumpHex = " Extra Data:" + nl;
theDumpHex += HexDump.dump(thedata, 0, 0);
}
}
catch ( Exception e )
{
theDumpHex = "Error!!";
}
return getClass().getName() + ":" + nl +
" isContainer: " + isContainerRecord() + nl +
" options: 0x" + HexDump.toHex( getOptions() ) + nl +
" recordId: 0x" + HexDump.toHex( getRecordId() ) + nl +
" numchildren: " + getChildRecords().size() + nl +
theDumpHex +
children.toString();
|
|