T
- public abstract class AbstractCodec<T> extends Object implements Codec<T>
Encoder
Constructor and Description |
---|
AbstractCodec()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsCharacter(char c,
char[] array)
Utility to search a char[] for a specific char.
|
T |
decodeCharacter(PushbackSequence<T> input)
Returns the decoded version of the next character from the input string and advances the
current character in the PushbackSequence.
|
String |
encode(char[] immune,
String input)
WARNING!!
Character based Codecs will silently transform code points that are not
legal UTF code points into garbage data as they will cast them to char s. |
String |
encodeCharacter(char[] immune,
char c) |
String |
encodeCharacter(char[] immune,
Character c)
WARNING!!!! Passing a standard char to this method will resolve to the
|
String |
encodeCharacter(char[] immune,
int codePoint)
Default codepoint implementation that should be overridden in specific codecs.
|
String |
getHexForNonAlphanumeric(char c)
Lookup the hex value of any character that is not alphanumeric.
|
String |
getHexForNonAlphanumeric(int c)
Lookup the hex value of any character that is not alphanumeric.
|
String |
toHex(char c) |
String |
toHex(int c) |
String |
toOctal(char c) |
public String encode(char[] immune, String input)
Character
based Codecs will silently transform code points that are not
legal UTF code points into garbage data as they will cast them to char
s.
If you are implementing an Integer
based codec, these will be silently discarded
based on the return from Character.isValidCodePoint( int )
. This is the preferred
behavior moving forward.
Encode a String so that it can be safely used in a specific context.public String encodeCharacter(char[] immune, Character c)
encodeCharacter
in interface Codec<T>
immune
- array of chars to NOT encode. Use with caution.c
- the Character to encodemethod instead of this one!!! YOU HAVE BEEN WARNED!!!!
{@inheritDoc}
public String encodeCharacter(char[] immune, char c)
public String encodeCharacter(char[] immune, int codePoint)
Codec
encodeCharacter
in interface Codec<T>
codePoint
- the integer to encodepublic T decodeCharacter(PushbackSequence<T> input)
Codec
decodeCharacter
in interface Codec<T>
input
- the Character to decodepublic String getHexForNonAlphanumeric(char c)
getHexForNonAlphanumeric
in interface Codec<T>
c
- The character to lookup.public String getHexForNonAlphanumeric(int c)
getHexForNonAlphanumeric
in interface Codec<T>
c
- The character to lookup.public boolean containsCharacter(char c, char[] array)
containsCharacter
in interface Codec<T>
Copyright © 2021 The Open Web Application Security Project (OWASP). All rights reserved.