public final class RESTEncodingHelper extends Object
Constructor and Description |
---|
RESTEncodingHelper() |
Modifier and Type | Method and Description |
---|---|
static String |
decode(String anEncoded)
Decodes a given encoded string.
|
static PrimaryKey |
decodePrimaryKey(String anEncodedPrimaryKey)
Decodes an encoded primary key string form into a primary key object.
|
static String |
encode(String aString)
Encodes a given string.
|
static String |
encodePrimaryKey(PrimaryKey aPrimaryKey)
Encodes a given primary key and transforms it into a string.
|
public static String encode(String aString)
The provided String
is encoded into the application/x-www-form-urlencoded
format using the UTF-8
encoding,
then the following characters are replaced:
aString
- the String
to encode.String
or null
.decode(String)
,
URLEncoder.encode(String, String)
public static String encodePrimaryKey(PrimaryKey aPrimaryKey)
The encoded primary key representation should be used in the URI
path.
aPrimaryKey
- a primary key to encode.String
form or null
.decodePrimaryKey(String)
,
encode(String)
public static PrimaryKey decodePrimaryKey(String anEncodedPrimaryKey) throws UnsupportedEncodingException
anEncodedPrimaryKey
- an encoded primary key to decode.Object
or null
.UnsupportedEncodingException
- if anEncodedPrimaryKey
cannot be decoded.decode(String)
,
encodePrimaryKey(PrimaryKey)
,
PrimaryKey.parseString(String)
public static String decode(String anEncoded) throws UnsupportedEncodingException
The provided String
is decoded from an application/x-www-form-urlencoded
format,
using UTF-8
encoding,
after the substitution of the following characters:
anEncoded
- the encoded String
.String
.UnsupportedEncodingException
- if anEncoded
cannot be decoded.URLDecoder.decode(String, String)