|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.codec.net.URLCodec
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.
Field Summary | |
protected String |
encoding
The String encoding used for decoding and encoding. |
protected static BitSet |
WWW_FORM_URL
BitSet of www-form-url safe characters. |
Constructor Summary | |
URLCodec()
Default constructor. |
|
URLCodec(String encoding)
Constructor which allows for the selection of an Encoding |
Method Summary | |
byte[] |
decode(byte[] pArray)
Decodes an array of URL safe 7-bit characters into an array of original bytes. |
Object |
decode(Object pObject)
Decodes a URL safe object into its original form. |
String |
decode(String pString)
Decodes a URL safe string into its original form. |
String |
decode(String pString,
String charset)
Decodes a URL safe string into its original form using the specified character set. |
static byte[] |
decodeUrl(byte[] pArray)
Decodes an array of URL safe 7-bit characters into an array of original bytes. |
byte[] |
encode(byte[] pArray)
Encodes an array of bytes into an array of URL safe 7-bit characters. |
Object |
encode(Object pObject)
Encodes an object into its URL safe form. |
String |
encode(String pString)
Encodes a string into its URL safe form. |
String |
encode(String pString,
String charset)
Encodes a string into its URL safe form using the specified character set. |
static byte[] |
encodeUrl(BitSet urlsafe,
byte[] pArray)
Encodes an array of bytes into an array of URL safe 7-bit characters. |
String |
getEncoding()
The String encoding used for decoding and encoding. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected String encoding
String
encoding used for decoding and encoding.
protected static final BitSet WWW_FORM_URL
Constructor Detail |
public URLCodec()
public URLCodec(String encoding)
Method Detail |
public static final byte[] encodeUrl(BitSet urlsafe, byte[] pArray)
urlsafe
- bitset of characters deemed URL safepArray
- array of bytes to convert to URL safe characters
public static final byte[] decodeUrl(byte[] pArray) throws DecoderException
pArray
- array of URL safe characters
DecoderException
- Thrown if URL decoding is unsuccessfulpublic byte[] encode(byte[] pArray)
encode
in interface BinaryEncoder
pArray
- array of bytes to convert to URL safe characters
public byte[] decode(byte[] pArray) throws DecoderException
decode
in interface BinaryDecoder
pArray
- array of URL safe characters
DecoderException
- Thrown if URL decoding is unsuccessfulpublic String encode(String pString, String charset) throws UnsupportedEncodingException
pString
- string to convert to a URL safe form
UnsupportedEncodingException
- Thrown if charset is not
supportedpublic String encode(String pString) throws EncoderException
encode
in interface StringEncoder
pString
- string to convert to a URL safe form
EncoderException
- Thrown if URL encoding is unsuccessfulpublic String decode(String pString, String charset) throws DecoderException, UnsupportedEncodingException
pString
- URL safe string to convert into its original form
DecoderException
- Thrown if URL decoding is unsuccessful
UnsupportedEncodingException
- Thrown if charset is not
supportedpublic String decode(String pString) throws DecoderException
decode
in interface StringDecoder
pString
- URL safe string to convert into its original form
DecoderException
- Thrown if URL decoding is unsuccessfulpublic Object encode(Object pObject) throws EncoderException
encode
in interface Encoder
pObject
- string to convert to a URL safe form
EncoderException
- Thrown if URL encoding is not
applicable to objects of this type or
if encoding is unsuccessfulpublic Object decode(Object pObject) throws DecoderException
decode
in interface Decoder
pObject
- URL safe object to convert into its original form
DecoderException
- Thrown if URL decoding is not
applicable to objects of this type
if decoding is unsuccessfulpublic String getEncoding()
String
encoding used for decoding and encoding.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |