Package org.owasp.esapi.codecs
Class CSSCodec
- java.lang.Object
-
- org.owasp.esapi.codecs.AbstractCodec<java.lang.Character>
-
- org.owasp.esapi.codecs.AbstractCharacterCodec
-
- org.owasp.esapi.codecs.CSSCodec
-
- All Implemented Interfaces:
Codec<java.lang.Character>
public class CSSCodec extends AbstractCharacterCodec
Implementation of the Codec interface for backslash encoding used in CSS.- Since:
- June 1, 2007
- Author:
- Jeff Williams (jeff.williams .at. aspectsecurity.com) Aspect Security
- See Also:
Encoder
-
-
Constructor Summary
Constructors Constructor Description CSSCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Character
decodeCharacter(PushbackSequence<java.lang.Character> input)
Returns the decoded version of the next character from the input string and advances the current character in the PushbackSequence.java.lang.String
encode(char[] immune, java.lang.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 tochar
s.java.lang.String
encodeCharacter(char[] immune, java.lang.Character c)
WARNING!!!! Passing a standard char to this method will resolve to the-
Methods inherited from class org.owasp.esapi.codecs.AbstractCharacterCodec
decode
-
Methods inherited from class org.owasp.esapi.codecs.AbstractCodec
containsCharacter, encodeCharacter, encodeCharacter, getHexForNonAlphanumeric, getHexForNonAlphanumeric, toHex, toHex, toOctal
-
-
-
-
Method Detail
-
encode
public java.lang.String encode(char[] immune, java.lang.String input)
Description copied from class:AbstractCodec
WARNING!!Character
based Codecs will silently transform code points that are not legal UTF code points into garbage data as they will cast them tochar
s. If you are implementing anInteger
based codec, these will be silently discarded based on the return fromCharacter.isValidCodePoint( int )
. This is the preferred behavior moving forward. Encode a String so that it can be safely used in a specific context.- Specified by:
encode
in interfaceCodec<java.lang.Character>
- Overrides:
encode
in classAbstractCodec<java.lang.Character>
input
- the String to encode- Returns:
- the encoded String
-
encodeCharacter
public java.lang.String encodeCharacter(char[] immune, java.lang.Character c)
WARNING!!!! Passing a standard char to this method will resolve to the Returns backslash encoded character.- Specified by:
encodeCharacter
in interfaceCodec<java.lang.Character>
- Overrides:
encodeCharacter
in classAbstractCodec<java.lang.Character>
- Parameters:
immune
-c
- the Character to encode- Returns:
- the encoded Character
- See Also:
method instead of this one!!! YOU HAVE BEEN WARNED!!!!
-
decodeCharacter
public java.lang.Character decodeCharacter(PushbackSequence<java.lang.Character> input)
Returns the decoded version of the next character from the input string and advances the current character in the 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.- Specified by:
decodeCharacter
in interfaceCodec<java.lang.Character>
- Overrides:
decodeCharacter
in classAbstractCodec<java.lang.Character>
- Parameters:
input
- the Character to decode- Returns:
- the decoded Character
-
-