|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.linkedin.restli.internal.common.AsciiHexEncoding
public class AsciiHexEncoding
This class is used to encode and decode a string using a given encoding char and a set of reserved characters to encode. All reserved characters are encoded to their ASCII hex value and prefixed with the encoding char. The encoding char is also encoded to it's respective ASCII hex value and prefixed with the encoding char. All encoded hex values are decoded to their ascii char value. Percent encoding could, for example, be implemented by using '%' as the escape char and '!', '#', '$', '&' ... as the reserved chars.
| Nested Class Summary | |
|---|---|
static class |
AsciiHexEncoding.CannotDecodeException
Defines the exception thrown when the string cannot be decoded |
| Constructor Summary | |
|---|---|
AsciiHexEncoding(char escapeChar,
char[] reservedChars)
|
|
AsciiHexEncoding(char encodingChar,
java.util.Set<java.lang.Character> reservedChars)
Constructor. |
|
| Method Summary | |
|---|---|
java.lang.String |
decode(java.lang.String s)
Decodes the string, . |
java.lang.String |
encode(java.lang.String s)
Encodes the incoming string according to the given escape character and reserved characters. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AsciiHexEncoding(char escapeChar,
char[] reservedChars)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public AsciiHexEncoding(char encodingChar,
java.util.Set<java.lang.Character> reservedChars)
throws java.lang.IllegalArgumentException
encodingChar - the character used for encodingreservedChars - the set of reserved characters to encode
java.lang.IllegalArgumentException - if problem with arguments| Method Detail |
|---|
public java.lang.String encode(java.lang.String s)
s - the string to encode
public java.lang.String decode(java.lang.String s)
throws AsciiHexEncoding.CannotDecodeException
s - the string to decode
AsciiHexEncoding.CannotDecodeException - if the string cannot be decoded
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||