URL.openConnection()
instead.
Please visit this webpage
for further details.@Deprecated public class URLCodec extends java.lang.Object implements BinaryEncoder, BinaryDecoder, StringEncoder, StringDecoder
Implements the 'www-form-urlencoded' encoding scheme, also misleadingly known as URL encoding.
For more detailed information please refer to Chapter 17.13.4 'Form content types' of the HTML 4.01 Specification
This codec is meant to be a replacement for standard Java classes
URLEncoder
and URLDecoder
on older Java platforms, as these classes in Java versions below
1.4 rely on the platform's default charset encoding.
Constructor and Description |
---|
URLCodec()
Deprecated.
Default constructor.
|
URLCodec(java.lang.String charset)
Deprecated.
Constructor which allows for the selection of a default charset
|
Modifier and Type | Method and Description |
---|---|
byte[] |
decode(byte[] bytes)
Deprecated.
Decodes an array of URL safe 7-bit characters into an array of
original bytes.
|
java.lang.Object |
decode(java.lang.Object pObject)
Deprecated.
Decodes a URL safe object into its original form.
|
java.lang.String |
decode(java.lang.String pString)
Deprecated.
Decodes a URL safe string into its original form using the default
string charset.
|
java.lang.String |
decode(java.lang.String pString,
java.lang.String charset)
Deprecated.
Decodes a URL safe string into its original form using the
specified encoding.
|
static byte[] |
decodeUrl(byte[] bytes)
Deprecated.
Decodes an array of URL safe 7-bit characters into an array of
original bytes.
|
byte[] |
encode(byte[] bytes)
Deprecated.
Encodes an array of bytes into an array of URL safe 7-bit
characters.
|
java.lang.Object |
encode(java.lang.Object pObject)
Deprecated.
Encodes an object into its URL safe form.
|
java.lang.String |
encode(java.lang.String pString)
Deprecated.
Encodes a string into its URL safe form using the default string
charset.
|
java.lang.String |
encode(java.lang.String pString,
java.lang.String charset)
Deprecated.
Encodes a string into its URL safe form using the specified
string charset.
|
static byte[] |
encodeUrl(java.util.BitSet urlsafe,
byte[] bytes)
Deprecated.
Encodes an array of bytes into an array of URL safe 7-bit
characters.
|
java.lang.String |
getDefaultCharset()
Deprecated.
The default charset used for string decoding and encoding.
|
java.lang.String |
getEncoding()
Deprecated.
use #getDefaultCharset()
|
public URLCodec()
public URLCodec(java.lang.String charset)
charset
- the default string charset to use.public static final byte[] encodeUrl(java.util.BitSet urlsafe, byte[] bytes)
urlsafe
- bitset of characters deemed URL safebytes
- array of bytes to convert to URL safe characterspublic static final byte[] decodeUrl(byte[] bytes) throws DecoderException
bytes
- array of URL safe charactersDecoderException
- Thrown if URL decoding is unsuccessfulpublic byte[] encode(byte[] bytes)
encode
in interface BinaryEncoder
bytes
- array of bytes to convert to URL safe characterspublic byte[] decode(byte[] bytes) throws DecoderException
decode
in interface BinaryDecoder
bytes
- array of URL safe charactersDecoderException
- Thrown if URL decoding is unsuccessfulpublic java.lang.String encode(java.lang.String pString, java.lang.String charset) throws java.io.UnsupportedEncodingException
pString
- string to convert to a URL safe formcharset
- the charset for pStringjava.io.UnsupportedEncodingException
- Thrown if charset is not
supportedpublic java.lang.String encode(java.lang.String pString) throws EncoderException
encode
in interface StringEncoder
pString
- string to convert to a URL safe formEncoderException
- Thrown if URL encoding is unsuccessfulgetDefaultCharset()
public java.lang.String decode(java.lang.String pString, java.lang.String charset) throws DecoderException, java.io.UnsupportedEncodingException
pString
- URL safe string to convert into its original formcharset
- the original string charsetDecoderException
- Thrown if URL decoding is unsuccessfuljava.io.UnsupportedEncodingException
- Thrown if charset is not
supportedpublic java.lang.String decode(java.lang.String pString) throws DecoderException
decode
in interface StringDecoder
pString
- URL safe string to convert into its original formDecoderException
- Thrown if URL decoding is unsuccessfulgetDefaultCharset()
public java.lang.Object encode(java.lang.Object pObject) throws EncoderException
encode
in interface Encoder
pObject
- string to convert to a URL safe formEncoderException
- Thrown if URL encoding is not
applicable to objects of this type or
if encoding is unsuccessfulpublic java.lang.Object decode(java.lang.Object pObject) throws DecoderException
decode
in interface Decoder
pObject
- URL safe object to convert into its original formDecoderException
- Thrown if URL decoding is not
applicable to objects of this type
if decoding is unsuccessfulpublic java.lang.String getEncoding()
String
encoding used for decoding and encoding.public java.lang.String getDefaultCharset()