public static CFRecordsAggregate createCFAggregate(RecordStream rs) {Record rec = rs.getNext();if (rec.getSid() != CFHeaderRecord.sid &&rec.getSid() != CFHeader12Record.sid) {throw new IllegalStateException("next record sid was " + rec.getSid()+ " instead of " + CFHeaderRecord.sid + " or " +CFHeader12Record.sid + " as expected");}CFHeaderBase header = (CFHeaderBase)rec;int nRules = header.getNumberOfConditionalFormats();CFRuleBase[] rules = new CFRuleBase[nRules];for (int i = 0; i < rules.length; i++) {rules[i] = (CFRuleBase) rs.getNext();}return new CFRecordsAggregate(header, rules);}

public static CFRecordsAggregate CreateCFAggregate(RecordStream rs){Record rec = rs.GetNext();if (rec.Sid != CFHeaderRecord.sid){throw new InvalidOperationException("next record sid was " + rec.Sid+ " instead of " + CFHeaderRecord.sid + " as expected");}CFHeaderRecord header = (CFHeaderRecord)rec;int nRules = header.NumberOfConditionalFormats;CFRuleRecord[] rules = new CFRuleRecord[nRules];for (int i = 0; i < rules.Length; i++){rules[i] = (CFRuleRecord)rs.GetNext();}return new CFRecordsAggregate(header, rules);}
