DrawingGroupRecordpublic class DrawingGroupRecord extends AbstractEscherHolderRecord
Fields Summary |
---|
public static final short | sid | static final int | MAX_RECORD_SIZE | private static final int | MAX_DATA_SIZE |
Constructors Summary |
---|
public DrawingGroupRecord()
| public DrawingGroupRecord(RecordInputStream in)
super( in );
|
Methods Summary |
---|
public int | getRawDataSize()
List escherRecords = getEscherRecords();
byte[] rawData = getRawData();
if (escherRecords.size() == 0 && rawData != null)
{
return rawData.length;
}
else
{
int size = 0;
for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); )
{
EscherRecord r = (EscherRecord) iterator.next();
size += r.getRecordSize();
}
return size;
}
| protected java.lang.String | getRecordName()
return "MSODRAWINGGROUP";
| public int | getRecordSize()Size of record (including 4 byte headers for all sections)
return grossSizeFromDataSize( getRawDataSize() );
| public short | getSid()
return sid;
| static int | grossSizeFromDataSize(int dataSize)
return dataSize + ( (dataSize - 1) / MAX_DATA_SIZE + 1 ) * 4;
| public int | serialize(int offset, byte[] data)
byte[] rawData = getRawData();
if (getEscherRecords().size() == 0 && rawData != null)
{
return writeData( offset, data, rawData );
}
else
{
byte[] buffer = new byte[getRawDataSize()];
int pos = 0;
for ( Iterator iterator = getEscherRecords().iterator(); iterator.hasNext(); )
{
EscherRecord r = (EscherRecord) iterator.next();
pos += r.serialize(pos, buffer, new NullEscherSerializationListener() );
}
return writeData( offset, data, buffer );
}
| private void | writeContinueHeader(byte[] data, int offset, int sizeExcludingHeader)
LittleEndian.putShort(data, 0 + offset, ContinueRecord.sid);
LittleEndian.putShort(data, 2 + offset, (short) sizeExcludingHeader);
| private int | writeData(int offset, byte[] data, byte[] rawData)
int writtenActualData = 0;
int writtenRawData = 0;
while (writtenRawData < rawData.length)
{
int segmentLength = Math.min( rawData.length - writtenRawData, MAX_DATA_SIZE);
if (writtenRawData / MAX_DATA_SIZE >= 2)
writeContinueHeader( data, offset, segmentLength );
else
writeHeader( data, offset, segmentLength );
writtenActualData += 4;
offset += 4;
ArrayUtil.arraycopy( rawData, writtenRawData, data, offset, segmentLength );
offset += segmentLength;
writtenRawData += segmentLength;
writtenActualData += segmentLength;
}
return writtenActualData;
| private void | writeHeader(byte[] data, int offset, int sizeExcludingHeader)
LittleEndian.putShort(data, 0 + offset, getSid());
LittleEndian.putShort(data, 2 + offset, (short) sizeExcludingHeader);
|
|