question: protected static byte [ ] [ ] parseDirectives ( byte [ ] buf , String [ ] keyTable , List < byte [ ] > realmChoices , int realmIndex ) throws SaslException { byte [ ] [ ] valueTable = new byte [ keyTable . length ] [ ] ; ByteArrayOutputStream key = new ByteArrayOutputStream ( 10 ) ; ByteArrayOutputStream value = new ByteArrayOutputStream ( 10 ) ; boolean gettingKey = true ; boolean gettingQuotedValue = false ; boolean expectSeparator = false ; byte bch ; int i = skipLws ( buf , 0 ) ; while ( i < buf . length ) { bch = buf [ i ] ; if ( gettingKey ) { if ( bch == ',' ) { if ( key . size ( ) != 0 ) { throw new SaslException ( "Directive key contains a ',':" + key ) ; } i = skipLws ( buf , i + 1 ) ; } else if ( bch == '=' ) { if ( key . size ( ) == 0 ) { throw new SaslException ( "Empty directive key" ) ; } gettingKey = false ; i = skipLws ( buf , i + 1 ) ; if ( i < buf . length ) { if ( buf [ i ] == '"' ) { gettingQuotedValue = true ; ++ i ; } } else { throw new SaslException ( "Valueless directive found: " + key . toString ( ) ) ; } } else if ( isLws ( bch ) ) { i = skipLws ( buf , i + 1 ) ; if ( i < buf . length ) { if ( buf [ i ] != '=' ) { throw new SaslException ( "'=' expected after key: " + key . toString ( ) ) ; } } else { throw new SaslException ( "'=' expected after key: " + key . toString ( ) ) ; } } else { key . write ( bch ) ; ++ i ; } } else if ( gettingQuotedValue ) { if ( bch == '\\' ) { ++ i ; if ( i < buf . length ) { value . write ( buf [ i ] ) ; ++ i ; } else { throw new SaslException ( "Unmatched quote found for directive: " + key . toString ( ) + " with value: " + value . toString ( ) ) ; } } else if ( bch == '"' ) { ++ i ; gettingQuotedValue = false ; expectSeparator = true ; } else { value . write ( bch ) ; ++ i ; } } else if ( isLws ( bch ) || bch == ',' ) { extractDirective ( key . toString ( ) , value . toByteArray ( ) , keyTable , valueTable , realmChoices , realmIndex ) ; key . reset ( ) ; value . reset ( ) ; gettingKey = true ; gettingQuotedValue = expectSeparator = false ; i = skipLws ( buf , i + 1 ) ; } else if ( expectSeparator ) { throw new SaslException ( "Expecting comma or linear whitespace after quoted string: \"" + value . toString ( ) + "\"" ) ; } else { value . write ( bch ) ; ++ i ; } } if ( gettingQuotedValue ) { throw new SaslException ( "Unmatched quote found for directive: " + key . toString ( ) + " with value: " + value . toString ( ) ) ; } if ( key . size ( ) > 0 ) { extractDirective ( key . toString ( ) , value . toByteArray ( ) , keyTable , valueTable , realmChoices , realmIndex ) ; } return valueTable ; }
target:  Parses digest-challenge string, extracting each token and value(s)