question: private LoadOffsetFieldType inferRecordAddressType ( String recordString ) { if ( recordString . charAt ( 0 ) != LEADING_CHAR_RECORD_MARK ) { log . error ( "Cannot infer record addressing type because line " + lineNum + " is not a record." ) ; return LoadOffsetFieldType . ADDRESSFIELDSIZEUNKNOWN ; } String r = recordString . substring ( CHARS_IN_RECORD_MARK ) ; int len = r . length ( ) ; if ( ( ( len + 1 ) / 2 ) != ( len / 2 ) ) { log . error ( "Cannot infer record addressing type because line " + lineNum + " does not " + "have the correct number of characters." ) ; return LoadOffsetFieldType . ADDRESSFIELDSIZEUNKNOWN ; } int datalen = Integer . parseInt ( r . substring ( 0 , 2 ) , 16 ) ; int checksumInRecord = Integer . parseInt ( r . substring ( len - 2 , len ) , 16 ) ; int calculatedChecksum = calculate8BitChecksum ( recordString . substring ( CHARS_IN_RECORD_MARK , recordString . length ( ) - CHARS_IN_CHECKSUM ) ) ; if ( calculatedChecksum != checksumInRecord ) { log . error ( "Cannot infer record addressing type because line " + lineNum + " does not have the correct checksum (expect 0x" + Integer . toHexString ( calculatedChecksum ) + ", found CHKSUM = 0x" + Integer . toHexString ( checksumInRecord ) + ")" ) ; return LoadOffsetFieldType . ADDRESSFIELDSIZEUNKNOWN ; } int computedLenIf16Bit = 2 + 4 + 2 + ( datalen * 2 ) + 2 ; int computedLenIf24Bit = computedLenIf16Bit + 2 ; if ( computedLenIf16Bit == len ) { if ( isSupportedRecordType ( Integer . parseInt ( r . substring ( 6 , 8 ) , 16 ) ) ) { return LoadOffsetFieldType . ADDRESSFIELDSIZE16BITS ; } else { log . error ( "Cannot infer record addressing type in line " + lineNum + " because record " + "type is an unsupported record type." ) ; return LoadOffsetFieldType . ADDRESSFIELDSIZEUNKNOWN ; } } if ( computedLenIf24Bit == len ) { if ( isSupportedRecordType ( Integer . parseInt ( r . substring ( 8 , 10 ) , 16 ) ) ) { return LoadOffsetFieldType . ADDRESSFIELDSIZE24BITS ; } else { log . error ( "Cannot infer record addressing type in line " + lineNum + " because record type is an unsupported record type." ) ; return LoadOffsetFieldType . ADDRESSFIELDSIZEUNKNOWN ; } } return LoadOffsetFieldType . ADDRESSFIELDSIZEUNKNOWN ; }
target:  Infers addressing type from contents of string containing a record. <p> Returns ADDRESSFIELDSIZEUNKNOWN if <ul> <li>the recordString does not begin with ':' <li>the length of recordString is not appropriate to define an integral number of bytes <li>the recordString checksum does not match a checksum computed for the recordString <li>if the record type extracted after inferring the addressing type is an unsupported record type <li>if the length of recordString did not match the length expected for the inferred addressing type. <ul>