org.apache.excalibur.instrument.manager.http.server
Class URLCoder

java.lang.Object
  extended by org.apache.excalibur.instrument.manager.http.server.URLCoder

public class URLCoder
extends java.lang.Object

The java.net.URLDecoder and java.net.URLEncoder classes that ship with Java do not support encoding until Java 1.4. But this tool needs to be able to be used with Java 1.3. This class makes that possible.


Constructor Summary
private URLCoder()
          Not instantiable.
 
Method Summary
static java.lang.String decode(java.lang.String value, java.lang.String encoding)
           
private static java.lang.String decodeChars(char[] chars, int start, int count, java.lang.String encoding)
           
static java.lang.String encode(java.lang.String value, java.lang.String encoding)
           
private static void encodeChars(java.lang.String value, java.lang.String encoding, java.lang.StringBuffer sb)
          Adds a string of characters in %xx encoded form to the specified StringBuffer.
private static char getDigit(int d)
          Returns a single upper case hex digit given a 0..15 number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLCoder

private URLCoder()
Not instantiable.

Method Detail

getDigit

private static char getDigit(int d)
Returns a single upper case hex digit given a 0..15 number.


encodeChars

private static void encodeChars(java.lang.String value,
                                java.lang.String encoding,
                                java.lang.StringBuffer sb)
                         throws java.io.UnsupportedEncodingException
Adds a string of characters in %xx encoded form to the specified StringBuffer.

Throws:
java.io.UnsupportedEncodingException

decodeChars

private static java.lang.String decodeChars(char[] chars,
                                            int start,
                                            int count,
                                            java.lang.String encoding)
                                     throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

encode

public static java.lang.String encode(java.lang.String value,
                                      java.lang.String encoding)
                               throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

decode

public static java.lang.String decode(java.lang.String value,
                                      java.lang.String encoding)
                               throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException