private static int doParseTrieToBuilder ( List < CharSequence > stack , CharSequence encoded , ImmutableMap . Builder < String , PublicSuffixType > builder ) { int encodedLen = encoded . length ( ) ; int idx = 0 ; char c = ' ' ; // Read all of the characters for this node. for ( ; idx < encodedLen ; idx ++ ) { c = encoded . charAt ( idx ) ; if ( c == ' ' || c == ' ' || c == ' ' || c == ' ' || c == ' ' ) { break ; } } stack . add ( 0 , reverse ( encoded . subSequence ( 0 , idx ) ) ) ; if ( c == ' ' || c == ' ' || c == ' ' || c == ' ' ) { // '!' represents an interior node that represents an ICANN entry in the map. // '?' represents a leaf node, which represents an ICANN entry in map. // ':' represents an interior node that represents a private entry in the map // ',' represents a leaf node, which represents a private entry in the map. String domain = PREFIX_JOINER . join ( stack ) ; if ( domain . length ( ) > 0 ) { builder . put ( domain , PublicSuffixType . fromCode ( c ) ) ; } } idx ++ ; if ( c != ' ' && c != ' ' ) { while ( idx < encodedLen ) { // Read all the children idx += doParseTrieToBuilder ( stack , encoded . subSequence ( idx , encodedLen ) , builder ) ; if ( encoded . charAt ( idx ) == ' ' || encoded . charAt ( idx ) == ' ' ) { // An extra '?' or ',' after a child node indicates the end of all children of this node. idx ++ ; break ; } } } stack . remove ( 0 ) ; return idx ; }
Parses a trie node and returns the number of characters consumed .