static Base64VLQResult decode ( String aStr , int aIndex ) { int strLen = aStr . length ( ) ; int result = 0 ; int shift = 0 ; boolean continuation ; int digit ; do { if ( aIndex >= strLen ) { throw new Error ( "Expected more digits in base 64 VLQ value." ) ; } digit = Base64 . decode ( aStr . charAt ( aIndex ++ ) ) ; if ( digit == - 1 ) { throw new Error ( "Invalid base64 digit: " + aStr . charAt ( aIndex - 1 ) ) ; } continuation = ( digit & VLQ_CONTINUATION_BIT ) != 0 ; digit &= VLQ_BASE_MASK ; result = result + ( digit << shift ) ; shift += VLQ_BASE_SHIFT ; } while ( continuation ) ; return new Base64VLQResult ( fromVLQSigned ( result ) , aIndex ) ; }
Decodes the next base 64 VLQ value from the given string and returns the value and the rest of the string via the out parameter .