|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.ByteArrayOutputStream
com.infoengine.util.UrlEncoder
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:
a
' through 'z
',
'A
' through 'Z
', and '0
'
through '9
' remain the same.
' is converted into a
plus sign '+
'.
%xy
", where xy is the
two-digit hexadecimal representation of the byte.
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 |
static boolean[] dontNeedEncoding
static final int MAX_BYTES_PER_CHAR
static final char[] toHex
Constructor Detail |
private UrlEncoder()
Method Detail |
public static String encode(String s)
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.
s
- String
to be translated.
String
.public static String encode(String s, String encoding)
x-www-form-urlencoded
format.
Hex escaped characters are first encoded using the given character encoding
before Hex escaping the resulting bytes.
s
- String
to be translated.encoding
- the character encoding name
String
.public static void encode(StringBuffer buf, String s)
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.
buf
- StringBuffer
to receive encoded characters.s
- String
to be translated.public static void encode(StringBuffer buf, String s, String encoding)
x-www-form-urlencoded
format.
Hex escaped characters are first encoded using the given character encoding
before Hex escaping the resulting bytes.
buf
- StringBuffer
to receive encoded characters.s
- String
to be translated.encoding
- the character encoding namepublic static String decode(String s)
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.
s
- String
to be translated.
String
.public static String decode(String encoded, String encoding)
encoded
- String
to be translated.encoding
- the character encoding name
String
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |