Class 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 Detail

      • CSSCodec

        public CSSCodec()
    • 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 to chars.

        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.
        Specified by:
        encode in interface Codec<java.lang.Character>
        Overrides:
        encode in class AbstractCodec<java.lang.Character>
        input - the String to encode
        Returns:
        the encoded String
      • 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 interface Codec<java.lang.Character>
        Overrides:
        decodeCharacter in class AbstractCodec<java.lang.Character>
        Parameters:
        input - the Character to decode
        Returns:
        the decoded Character