@ Trivial private static String encode ( String s ) { if ( s == null ) { return null ; } // Throw an IllegalArgumentException if "%21" is already present in the String if ( s . contains ( "%21" ) ) { throw new IllegalArgumentException ( "WSJPAURLUtils.encode() cannot encode Strings containing \"%21\"." ) ; } return s . replace ( "!" , "%21" ) ; }
Private method that substitutes ! characters with its escaped code %21 .