org.apache.commons.codec.net
Class URLCodec
- BinaryDecoder, BinaryEncoder, Decoder, Encoder, StringDecoder, StringEncoder
Version:
- Apache Software Foundation
- 1.2
protected static byte | ESCAPE_CHAR
|
protected static BitSet | WWW_FORM_URL - BitSet of www-form-url safe characters.
|
protected String | charset - The default charset used for string decoding and encoding.
|
URLCodec() - Default constructor.
|
URLCodec(String charset) - Constructor which allows for the selection of a default charset
|
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 using the default
string charset.
|
String | decode(String pString, String charset) - Decodes a URL safe string into its original form using the
specified encoding.
|
byte[] | decode(byte[] bytes) - Decodes an array of URL safe 7-bit characters into an array of
original bytes.
|
static byte[] | decodeUrl(byte[] bytes) - Decodes an array of URL safe 7-bit characters into an array of
original bytes.
|
Object | encode(Object pObject) - Encodes an object into its URL safe form.
|
String | encode(String pString) - Encodes a string into its URL safe form using the default string
charset.
|
String | encode(String pString, String charset) - Encodes a string into its URL safe form using the specified
string charset.
|
byte[] | encode(byte[] bytes) - Encodes an array of bytes into an array of URL safe 7-bit
characters.
|
static byte[] | encodeUrl(BitSet urlsafe, byte[] bytes) - Encodes an array of bytes into an array of URL safe 7-bit
characters.
|
String | getDefaultCharset() - The default charset used for string decoding and encoding.
|
String | getEncoding() - use #getDefaultCharset()
|
ESCAPE_CHAR
protected static byte ESCAPE_CHAR
WWW_FORM_URL
protected static final BitSet WWW_FORM_URL
BitSet of www-form-url safe characters.
charset
protected String charset
The default charset used for string decoding and encoding.
URLCodec
public URLCodec()
Default constructor.
URLCodec
public URLCodec(String charset)
Constructor which allows for the selection of a default charset
charset
- the default string charset to use.
decode
public Object decode(Object pObject)
throws DecoderException
Decodes a URL safe object into its original form. Escaped
characters are converted back to their original representation.
- decode in interface Decoder
pObject
- URL safe object to convert into its original form
- original object
DecoderException
- Thrown if URL decoding is not
applicable to objects of this type
if decoding is unsuccessful
decode
public String decode(String pString)
throws DecoderException
Decodes a URL safe string into its original form using the default
string charset. Escaped characters are converted back to their
original representation.
- decode in interface StringDecoder
pString
- URL safe string to convert into its original form
- original string
DecoderException
- Thrown if URL decoding is unsuccessful
getDefaultCharset()
decode
public String decode(String pString,
String charset)
throws DecoderException,
UnsupportedEncodingException
Decodes a URL safe string into its original form using the
specified encoding. Escaped characters are converted back
to their original representation.
pString
- URL safe string to convert into its original formcharset
- the original string charset
- original string
DecoderException
- Thrown if URL decoding is unsuccessful
decode
public byte[] decode(byte[] bytes)
throws DecoderException
Decodes an array of URL safe 7-bit characters into an array of
original bytes. Escaped characters are converted back to their
original representation.
- decode in interface BinaryDecoder
bytes
- array of URL safe characters
- array of original bytes
DecoderException
- Thrown if URL decoding is unsuccessful
decodeUrl
public static final byte[] decodeUrl(byte[] bytes)
throws DecoderException
Decodes an array of URL safe 7-bit characters into an array of
original bytes. Escaped characters are converted back to their
original representation.
bytes
- array of URL safe characters
- array of original bytes
DecoderException
- Thrown if URL decoding is unsuccessful
encode
public Object encode(Object pObject)
throws EncoderException
Encodes an object into its URL safe form. Unsafe characters are
escaped.
- encode in interface Encoder
pObject
- string to convert to a URL safe form
- URL safe object
EncoderException
- Thrown if URL encoding is not
applicable to objects of this type or
if encoding is unsuccessful
encode
public String encode(String pString,
String charset)
throws UnsupportedEncodingException
Encodes a string into its URL safe form using the specified
string charset. Unsafe characters are escaped.
pString
- string to convert to a URL safe formcharset
- the charset for pString
- URL safe string
encode
public byte[] encode(byte[] bytes)
Encodes an array of bytes into an array of URL safe 7-bit
characters. Unsafe characters are escaped.
- encode in interface BinaryEncoder
bytes
- array of bytes to convert to URL safe characters
- array of bytes containing URL safe characters
encodeUrl
public static final byte[] encodeUrl(BitSet urlsafe,
byte[] bytes)
Encodes an array of bytes into an array of URL safe 7-bit
characters. Unsafe characters are escaped.
urlsafe
- bitset of characters deemed URL safebytes
- array of bytes to convert to URL safe characters
- array of bytes containing URL safe characters
getDefaultCharset
public String getDefaultCharset()
The default charset used for string decoding and encoding.
- the default string charset.
getEncoding
public String getEncoding()
use #getDefaultCharset()
The String
encoding used for decoding and encoding.
- Returns the encoding.
commons-codec version 1.3 - Copyright © 2002-2004 - Apache Software Foundation