public int serialize( int offset, byte[] data, EscherSerializationListener listener ){listener.beforeRecordSerialize( offset, getRecordId(), this );LittleEndian.putShort(data, offset, getOptions());LittleEndian.putShort(data, offset+2, getRecordId());int remainingBytes = 0;for (EscherRecord r : this) {remainingBytes += r.getRecordSize();}remainingBytes += _remainingLength;LittleEndian.putInt(data, offset+4, remainingBytes);int pos = offset+8;for (EscherRecord r : this) {pos += r.serialize(pos, data, listener );}listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );return pos - offset;}
public override int Serialize(int offset, byte[] data, EscherSerializationListener listener){listener.BeforeRecordSerialize(offset, RecordId, this);LittleEndian.PutShort(data, offset, Options);LittleEndian.PutShort(data, offset + 2, RecordId);int remainingBytes = 0;for (IEnumerator iterator = ChildRecords.GetEnumerator(); iterator.MoveNext(); ){EscherRecord r = (EscherRecord)iterator.Current;remainingBytes += r.RecordSize;}remainingBytes += _remainingLength;LittleEndian.PutInt(data, offset + 4, remainingBytes);int pos = offset + 8;for (IEnumerator iterator = ChildRecords.GetEnumerator(); iterator.MoveNext(); ){EscherRecord r = (EscherRecord)iterator.Current;pos += r.Serialize(pos, data, listener);}listener.AfterRecordSerialize(pos, RecordId, pos - offset, this);return pos - offset;}