private int decodeAlphanumeric ( QrCode qr , PackedBits8 data , int bitLocation ) { int lengthBits = QrCodeEncoder . getLengthBitsAlphanumeric ( qr . version ) ; int length = data . read ( bitLocation , lengthBits , true ) ; bitLocation += lengthBits ; while ( length >= 2 ) { if ( data . size < bitLocation + 11 ) { qr . failureCause = QrCode . Failure . MESSAGE_OVERFLOW ; return - 1 ; } int chunk = data . read ( bitLocation , 11 , true ) ; bitLocation += 11 ; int valA = chunk / 45 ; int valB = chunk - valA * 45 ; workString . append ( valueToAlphanumeric ( valA ) ) ; workString . append ( valueToAlphanumeric ( valB ) ) ; length -= 2 ; } if ( length == 1 ) { if ( data . size < bitLocation + 6 ) { qr . failureCause = QrCode . Failure . MESSAGE_OVERFLOW ; return - 1 ; } int valA = data . read ( bitLocation , 6 , true ) ; bitLocation += 6 ; workString . append ( valueToAlphanumeric ( valA ) ) ; } return bitLocation ; }
Decodes alphanumeric messages