/** ** Main entry point for testing/debugging ** @param argv Comand-line arguments */ public static void main(String argv[]) { RTConfig.setCommandLineArgs(argv); /* decode URI argument strings */ if (RTConfig.hasProperty(ARG_DECODE)) { String a = RTConfig.getString(ARG_DECODE, ""); String s = URIArg.decodeArg(new StringBuffer(), a).toString(); Print.sysPrintln("ASCII: " + s); System.exit(0); } /* encode Base64 strings */ if (RTConfig.hasProperty(ARG_ENCODE)) { String s = RTConfig.getString(ARG_ENCODE, ""); String a = URIArg.encodeArg(new StringBuffer(), s).toString(); Print.sysPrintln("Args: " + a); System.exit(0); } /* RTP decode */ if (RTConfig.hasProperty(ARG_RTPDEC)) { URIArg rtpUrl = new URIArg(RTConfig.getString(ARG_RTPDEC, "")); URIArg decUrl = rtpUrl.rtpDecode("rtp"); Print.sysPrintln("URL: " + decUrl.toString()); System.exit(0); } /* RTP encode */ if (RTConfig.hasProperty(ARG_RTPENC)) { URIArg decUrl = new URIArg(RTConfig.getString(ARG_RTPENC, "")); URIArg rtpUrl = decUrl.rtpEncode("rtp"); Print.sysPrintln("URL: " + rtpUrl.toString()); System.exit(0); } /* no options */ usage(); }
/** * ** Hex-encodes a URL argument ** @param s The URL argument to encode ** @param obfuscateAll * True to force hex-encoding on all argument characters ** @return The hex-encoded String */ private String encodeArg(String s, boolean obfuscateAll) { StringBuffer sb = URIArg.encodeArg(null, s, obfuscateAll); return sb.toString(); }
/** * ** Obfuscates (hex-encodes) all characters in the String ** @param s The String to hex-encode * ** @return The hex-encoded String */ public static String obfuscateArg(String s) { return URIArg.encodeArg(new StringBuffer(), s, true).toString(); }
/** * ** Hex-encodes a URL argument (if required) ** @param sb The StringBuffer where the hex encoded * String argument will be placed ** @param s The URL argument to encode (if required) ** @return * The StringBuffer where the hex-encoded String will be placed */ public static StringBuffer encodeArg(StringBuffer sb, String s) { return URIArg.encodeArg(sb, s, false); }
/** * ** Hex-encodes a URL argument (if required) ** @param s The URL argument to encode (if * required) ** @return The hex encoded argument */ public static String encodeArg(String s) { return URIArg.encodeArg(null, s, false).toString(); }