com.infoengine.util
Class UrlEncoder

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.ByteArrayOutputStream
          extended bycom.infoengine.util.UrlEncoder

public class UrlEncoder
extends ByteArrayOutputStream

This class should no longer be used. The appropriate java.net.URLEncoder/Decoder equivalent should be used instead.

The class contains a utility method for converting a String into a MIME format called "x-www-form-urlencoded" and vice versa.

To convert a String, each character is examined in turn:



Supported API: true
Extendable: false


Field Summary
(package private) static boolean[] dontNeedEncoding
          Deprecated.  
(package private) static int MAX_BYTES_PER_CHAR
          Deprecated.  
(package private) static char[] toHex
          Deprecated.  
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Constructor Summary
private UrlEncoder()
          Deprecated.  
 
Method Summary
static String decode(String s)
          Deprecated. Translates a string from x-www-form-urlencoded format back into a string.
static String decode(String encoded, String encoding)
          Deprecated. Translates a unescaped urlencoded string using the given character encoding.
static String encode(String s)
          Deprecated. Translates a string into x-www-form-urlencoded format.
static void encode(StringBuffer buf, String s)
          Deprecated. Translates a string into x-www-form-urlencoded format.
static void encode(StringBuffer buf, String s, String encoding)
          Deprecated. Translates a string into x-www-form-urlencoded format.
static String encode(String s, String encoding)
          Deprecated. Translates a string into x-www-form-urlencoded format.
 
Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, write, write, writeTo
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dontNeedEncoding

static boolean[] dontNeedEncoding
Deprecated. 

MAX_BYTES_PER_CHAR

static final int MAX_BYTES_PER_CHAR
Deprecated. 
See Also:
Constant Field Values

toHex

static final char[] toHex
Deprecated. 
Constructor Detail

UrlEncoder

private UrlEncoder()
Deprecated. 
Method Detail

encode

public static String encode(String s)
Deprecated. 
Translates a string into x-www-form-urlencoded format. Hex escaped characters are first encoded using UTF8 character encoding before Hex escaping the resulting bytes. This produces an encoded string that can be decoded without loss of data.

Supported API: true

Parameters:
s - String to be translated.
Returns:
the translated String.

encode

public static String encode(String s,
                            String encoding)
Deprecated. 
Translates a string into x-www-form-urlencoded format. Hex escaped characters are first encoded using the given character encoding before Hex escaping the resulting bytes.

Supported API: true

Parameters:
s - String to be translated.
encoding - the character encoding name
Returns:
the translated String.

encode

public static void encode(StringBuffer buf,
                          String s)
Deprecated. 
Translates a string into x-www-form-urlencoded format. Hex escaped characters are first encoded using UTF8 character encoding before Hex escaping the resulting bytes. This produces an encoded string that can be decoded without loss of data.

Supported API: true

Parameters:
buf - StringBuffer to receive encoded characters.
s - String to be translated.

encode

public static void encode(StringBuffer buf,
                          String s,
                          String encoding)
Deprecated. 
Translates a string into x-www-form-urlencoded format. Hex escaped characters are first encoded using the given character encoding before Hex escaping the resulting bytes.

Supported API: true

Parameters:
buf - StringBuffer to receive encoded characters.
s - String to be translated.
encoding - the character encoding name

decode

public static String decode(String s)
Deprecated. 
Translates a string from x-www-form-urlencoded format back into a string. Hex escaped bytes are converted and the resulting sequence of 8-bit values is converted to characters using UTF8 encoding. This produces a decoded string from the results of encode without loss data.

Supported API: true

Parameters:
s - String to be translated.
Returns:
the translated String.

decode

public static String decode(String encoded,
                            String encoding)
Deprecated. 
Translates a unescaped urlencoded string using the given character encoding. This method appears to do nothing useful. Seems not much more than an expensive string copy. This method should not be used!

Supported API: true

Parameters:
encoded - String to be translated.
encoding - the character encoding name
Returns:
the translated String.