Search in sources :

Example 1 with NullEscherSerializationListener

use of org.apache.poi.ddf.NullEscherSerializationListener in project poi by apache.

the class DrawingGroupRecord method serialize.

public int serialize(int offset, byte[] data) {
    byte[] rawData = getRawData();
    if (getEscherRecords().size() == 0 && rawData != null) {
        return writeData(offset, data, rawData);
    }
    byte[] buffer = new byte[getRawDataSize()];
    int pos = 0;
    for (Iterator<EscherRecord> iterator = getEscherRecords().iterator(); iterator.hasNext(); ) {
        EscherRecord r = iterator.next();
        pos += r.serialize(pos, buffer, new NullEscherSerializationListener());
    }
    return writeData(offset, data, buffer);
}
Also used : NullEscherSerializationListener(org.apache.poi.ddf.NullEscherSerializationListener) EscherRecord(org.apache.poi.ddf.EscherRecord)

Example 2 with NullEscherSerializationListener

use of org.apache.poi.ddf.NullEscherSerializationListener in project poi by apache.

the class AbstractEscherHolderRecord method serialize.

@Override
public int serialize(int offset, byte[] data) {
    LittleEndian.putShort(data, 0 + offset, getSid());
    LittleEndian.putShort(data, 2 + offset, (short) (getRecordSize() - 4));
    byte[] rawData = getRawData();
    if (escherRecords.size() == 0 && rawData != null) {
        LittleEndian.putShort(data, 0 + offset, getSid());
        LittleEndian.putShort(data, 2 + offset, (short) (getRecordSize() - 4));
        System.arraycopy(rawData, 0, data, 4 + offset, rawData.length);
        return rawData.length + 4;
    }
    LittleEndian.putShort(data, 0 + offset, getSid());
    LittleEndian.putShort(data, 2 + offset, (short) (getRecordSize() - 4));
    int pos = offset + 4;
    for (EscherRecord r : escherRecords) {
        pos += r.serialize(pos, data, new NullEscherSerializationListener());
    }
    return getRecordSize();
}
Also used : NullEscherSerializationListener(org.apache.poi.ddf.NullEscherSerializationListener) EscherRecord(org.apache.poi.ddf.EscherRecord)

Aggregations

EscherRecord (org.apache.poi.ddf.EscherRecord)2 NullEscherSerializationListener (org.apache.poi.ddf.NullEscherSerializationListener)2