public int serialize( int offset, byte[] data ) {LOG.log( DEBUG, "Serializing Workbook with offsets" );int pos = 0;SSTRecord lSST = null;int sstPos = 0;boolean wroteBoundSheets = false;for ( org.apache.poi.hssf.record.Record record : records.getRecords() ) {int len = 0;if (record instanceof SSTRecord) {lSST = (SSTRecord)record;sstPos = pos;}if (record.getSid() == ExtSSTRecord.sid && lSST != null) {record = lSST.createExtSSTRecord(sstPos + offset);}if (record instanceof BoundSheetRecord) {if(!wroteBoundSheets) {for (BoundSheetRecord bsr : boundsheets) {len += bsr.serialize(pos+offset+len, data);}wroteBoundSheets = true;}} else {len = record.serialize( pos + offset, data );}pos += len;}LOG.log( DEBUG, "Exiting serialize workbook" );return pos;}
public int Serialize(int offset, byte[] data){int pos = 0;SSTRecord sst = null;int sstPos = 0;bool wroteBoundSheets = false;for (int k = 0; k < records.Count; k++){Record record = records[k];if (record.Sid != RecalcIdRecord.sid || ((RecalcIdRecord)record).IsNeeded){int len = 0;if (record is SSTRecord){sst = (SSTRecord)record;sstPos = pos;}if (record.Sid == ExtSSTRecord.sid && sst != null){record = sst.CreateExtSSTRecord(sstPos + offset);}if (record is BoundSheetRecord){if (!wroteBoundSheets){for (int i = 0; i < boundsheets.Count; i++){len += ((BoundSheetRecord)boundsheets[i]).Serialize(pos + offset + len, data);}wroteBoundSheets = true;}}else{len = record.Serialize(pos + offset, data);}pos += len;   }}return pos;}