public class CSSCodec extends AbstractCharacterCodec
Encoder
Constructor and Description |
---|
CSSCodec() |
Modifier and Type | Method and Description |
---|---|
Character |
decodeCharacter(PushbackSequence<Character> 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)
Encode a String so that it can be safely used in a specific context.
|
String |
encodeCharacter(char[] immune,
Character c)
Default implementation that should be overridden in specific codecs.
|
decode
containsCharacter, encodeCharacter, encodeCharacter, getHexForNonAlphanumeric, getHexForNonAlphanumeric, toHex, toHex, toOctal
public String encode(char[] immune, String input)
AbstractCodec
WARNING!! Character
based Codec
s will silently transform code points that are not
legal UTF code points into garbage data as they will cast them to char
s.
Also, 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.
public String encodeCharacter(char[] immune, Character c)
WARNING!!!! Passing a standard char
rather than Character
to this method will resolve to the
AbstractCodec.encodeCharacter( char[], char )
method, which will throw an IllegalArgumentException
instead.
YOU HAVE BEEN WARNED!!!!
Returns backslash encoded character.
encodeCharacter
in interface Codec<Character>
encodeCharacter
in class AbstractCodec<Character>
immune
- c
- the Character to encodepublic Character decodeCharacter(PushbackSequence<Character> input)
PushbackSequence
. If the current character is not encoded, this
method MUST reset the PushbackString
.
Returns the decoded version of the character starting at index,
or null if no decoding is possible.decodeCharacter
in interface Codec<Character>
decodeCharacter
in class AbstractCodec<Character>
input
- the Character to decodeCopyright © 2022 The Open Web Application Security Project (OWASP). All rights reserved.