org.gridlab.gat
Class URI.URIEncoder

java.lang.Object
  extended by org.gridlab.gat.URI.URIEncoder
Enclosing class:
URI

public class URI.URIEncoder
extends Object

A utility class that encodes/decodes Strings into a valid URI format.


Constructor Summary
URI.URIEncoder()
           
 
Method Summary
 String decodeUri(String uri)
          Decodes a string according to RFC 2396.
 void decodeUri(String uri, StringBuffer buf)
          Decodes a string according to RFC 2396.
 String encodeUri(String uri)
          Encodes a string according to RFC 2396.
 void encodeUri(String uri, StringBuffer buf)
          Encodes a string according to RFC 2396.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URI.URIEncoder

public URI.URIEncoder()
Method Detail

encodeUri

public String encodeUri(String uri)
Encodes a string according to RFC 2396. According to this spec, any characters outside the range 0x20 - 0x7E must be escaped because they are not printable characters, except for characters in the fragment identifier. Even within this range a number of characters must be escaped. This method will perform this escaping.

Parameters:
uri - The URI to encode.
Returns:
The encoded URI.

encodeUri

public void encodeUri(String uri,
                      StringBuffer buf)
Encodes a string according to RFC 2396.

Parameters:
uri - The URI to encode.
buf - The StringBuffer that the encoded URI will be appended to.
See Also:
encodeUri(java.lang.String)

decodeUri

public String decodeUri(String uri)
Decodes a string according to RFC 2396. According to this spec, any characters outside the range 0x20 - 0x7E must be escaped because they are not printable characters, except for any characters in the fragment identifier. This method will translate any escaped characters back to the original.

Parameters:
uri - The URI to decode.
Returns:
The decoded URI.

decodeUri

public void decodeUri(String uri,
                      StringBuffer buf)
Decodes a string according to RFC 2396.

Parameters:
uri - The URI to decode.
buf - The StringBuffer that the decoded URI will be appended to.
See Also:
decodeUri(java.lang.String)