public String decode ( String encodedStr ) { String [ ] suppliedBits = encodedStr . split ( ARGUMENT_PLACE_HOLDER , - 1 ) ; String originalStr = originalToNewNameMap . get ( suppliedBits [ 0 ] ) ; if ( originalStr == null ) { return encodedStr ; // Failed to decode. } String [ ] originalBits = originalStr . split ( ARGUMENT_PLACE_HOLDER , - 1 ) ; StringBuilder sb = new StringBuilder ( originalBits [ 0 ] ) ; for ( int i = 1 ; i < Math . max ( originalBits . length , suppliedBits . length ) ; i ++ ) { // Replace missing bits with "-". Shouldn't happen except that we aren't // escaping the replacement token at the moment. sb . append ( i < suppliedBits . length ? suppliedBits [ i ] : "-" ) ; sb . append ( i < originalBits . length ? originalBits [ i ] : "-" ) ; } return sb . toString ( ) ; }
Decodes an encoded string from the JS Compiler ReplaceStrings pass .