public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) {int bytesRemaining = readHeader( data, offset );int available = data.length - (offset + 8);if (bytesRemaining > available) {bytesRemaining = available;}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;}if (bytesRemaining < 0) {bytesRemaining = 0;}thedata = IOUtils.safelyAllocate(bytesRemaining, MAX_RECORD_LENGTH);System.arraycopy( data, offset + 8, thedata, 0, bytesRemaining );return bytesRemaining + 8;}
public override int FillFields(byte[] data, int offset, IEscherRecordFactory recordFactory){int bytesRemaining = ReadHeader(data, offset);int avaliable = data.Length - (offset + 8);if (bytesRemaining > avaliable){bytesRemaining = avaliable;}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;ChildRecords.Add(child);}return bytesWritten;}else{_thedata = new byte[bytesRemaining];Array.Copy(data, offset + 8, _thedata, 0, bytesRemaining);return bytesRemaining + 8;}}