public ObjRecord(RecordInputStream in) {byte[] subRecordData = in.readRemainder();if (LittleEndian.getUShort(subRecordData, 0) != CommonObjectDataSubRecord.sid) {_uninterpretedData = subRecordData;return;}LittleEndianByteArrayInputStream subRecStream = new LittleEndianByteArrayInputStream(subRecordData);CommonObjectDataSubRecord cmo = (CommonObjectDataSubRecord)SubRecord.createSubRecord(subRecStream, 0);subrecords.add(cmo);while (true) {SubRecord subRecord = SubRecord.createSubRecord(subRecStream, cmo.getObjectType());subrecords.add(subRecord);if (subRecord.isTerminating()) {break;}}final int nRemainingBytes = subRecordData.length-subRecStream.getReadIndex();if (nRemainingBytes > 0) {_isPaddedToQuadByteMultiple = subRecordData.length % MAX_PAD_ALIGNMENT == 0;if (nRemainingBytes >= (_isPaddedToQuadByteMultiple ? MAX_PAD_ALIGNMENT : NORMAL_PAD_ALIGNMENT)) {if (!canPaddingBeDiscarded(subRecordData, nRemainingBytes)) {String msg = "Leftover " + nRemainingBytes+ " bytes in subrecord data " + HexDump.toHex(subRecordData);throw new RecordFormatException(msg);}_isPaddedToQuadByteMultiple = false;}} else {_isPaddedToQuadByteMultiple = false;}_uninterpretedData = null;}
public ObjRecord(RecordInputStream in1){byte[] subRecordData = in1.ReadRemainder();if (LittleEndian.GetUShort(subRecordData, 0) != CommonObjectDataSubRecord.sid){_uninterpretedData = subRecordData;subrecords = null;return;}subrecords = new List<SubRecord>();using (MemoryStream bais = new MemoryStream(subRecordData)){LittleEndianInputStream subRecStream = new LittleEndianInputStream(bais);CommonObjectDataSubRecord cmo = (CommonObjectDataSubRecord)SubRecord.CreateSubRecord(subRecStream, 0);subrecords.Add(cmo);while (true){SubRecord subRecord = SubRecord.CreateSubRecord(subRecStream, cmo.ObjectType);subrecords.Add(subRecord);if (subRecord.IsTerminating){break;}}int nRemainingBytes = subRecStream.Available();if (nRemainingBytes > 0){_isPaddedToQuadByteMultiple = subRecordData.Length % MAX_PAD_ALIGNMENT == 0;if (nRemainingBytes >= (_isPaddedToQuadByteMultiple ? MAX_PAD_ALIGNMENT : NORMAL_PAD_ALIGNMENT)){if (!CanPaddingBeDiscarded(subRecordData, nRemainingBytes)){String msg = "Leftover " + nRemainingBytes+ " bytes in subrecord data " + HexDump.ToHex(subRecordData);throw new RecordFormatException(msg);}_isPaddedToQuadByteMultiple = false;}}else{_isPaddedToQuadByteMultiple = false;}_uninterpretedData = null;}}