|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.util.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 classesURLEncoder
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 static byte |
ESCAPE_CHAR
|
protected static java.util.BitSet |
WWW_FORM_URL
BitSet of www-form-url safe characters. |
Constructor Summary | |
URLCodec()
|
Method Summary | |
static byte[] |
decode(byte[] bytes)
Decodes an array of URL safe 7-bit characters into an array of original bytes. |
static java.lang.Object |
decode(java.lang.Object pObject)
Decodes a URL safe object into its original form. |
static java.lang.String |
decode(java.lang.String pString)
Decodes a URL safe string into its original form using the default string charset. |
static java.lang.String |
decode(java.lang.String pString,
java.lang.String charset)
Decodes a URL safe string into its original form using the specified encoding. |
static byte[] |
decodeUrl(byte[] bytes)
Decodes an array of URL safe 7-bit characters into an array of original bytes. |
static byte[] |
encode(byte[] bytes)
Encodes an array of bytes into an array of URL safe 7-bit characters. |
static java.lang.Object |
encode(java.lang.Object pObject)
Encodes an object into its URL safe form. |
static java.lang.String |
encode(java.lang.String pString)
Encodes a string into its URL safe form using the default string charset. |
static java.lang.String |
encode(java.lang.String pString,
java.lang.String charset)
Encodes a string into its URL safe form using the specified string charset. |
static byte[] |
encodeUrl(java.util.BitSet urlsafe,
byte[] bytes)
Encodes an array of bytes into an array of URL safe 7-bit characters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static byte ESCAPE_CHAR
protected static final java.util.BitSet WWW_FORM_URL
Constructor Detail |
public URLCodec()
Method Detail |
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 characters
public static final byte[] decodeUrl(byte[] bytes) throws java.io.UnsupportedEncodingException
bytes
- array of URL safe characters
java.io.UnsupportedEncodingException
- Thrown if URL decoding is unsuccessfulpublic static byte[] encode(byte[] bytes)
bytes
- array of bytes to convert to URL safe characters
public static byte[] decode(byte[] bytes) throws java.io.UnsupportedEncodingException
bytes
- array of URL safe characters
java.io.UnsupportedEncodingException
- Thrown if URL decoding is unsuccessfulpublic static 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 pString
java.io.UnsupportedEncodingException
- Thrown if charset is not
supportedpublic static java.lang.String encode(java.lang.String pString) throws java.io.UnsupportedEncodingException
pString
- string to convert to a URL safe form
java.io.UnsupportedEncodingException
- Thrown if URL encoding is unsuccessful#getDefaultCharset()
public static java.lang.String decode(java.lang.String pString, java.lang.String charset) throws java.io.UnsupportedEncodingException
pString
- URL safe string to convert into its original formcharset
- the original string charset
java.io.UnsupportedEncodingException
- Thrown if charset is not
supportedpublic static java.lang.String decode(java.lang.String pString) throws java.io.UnsupportedEncodingException
pString
- URL safe string to convert into its original form
java.io.UnsupportedEncodingException
- Thrown if URL decoding is unsuccessful#getDefaultCharset()
public static java.lang.Object encode(java.lang.Object pObject) throws java.io.UnsupportedEncodingException
pObject
- string to convert to a URL safe form
java.io.UnsupportedEncodingException
- Thrown if URL encoding is not
applicable to objects of this type or
if encoding is unsuccessfulpublic static java.lang.Object decode(java.lang.Object pObject) throws java.io.UnsupportedEncodingException
pObject
- URL safe object to convert into its original form
java.io.UnsupportedEncodingException
- Thrown if the argument is not a String
or byte[]
. Thrown if a failure condition is
encountered during the decode process.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |