Package org.owasp.esapi.codecs
Class HTMLEntityCodec
- java.lang.Object
-
- org.owasp.esapi.codecs.Codec
-
- org.owasp.esapi.codecs.HTMLEntityCodec
-
public class HTMLEntityCodec extends Codec
Implementation of the Codec interface for HTML entity encoding.- Since:
- June 1, 2007
- Author:
- Jeff Williams (jeff.williams .at. aspectsecurity.com) Aspect Security
- See Also:
Encoder
-
-
Constructor Summary
Constructors Constructor Description HTMLEntityCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Character
decodeCharacter(PushbackString input)
Returns the decoded version of the next character from the input string and advances the current character in the PushbackString.java.lang.String
encodeCharacter(char[] immune, java.lang.Character c)
Default implementation that should be overridden in specific codecs.-
Methods inherited from class org.owasp.esapi.codecs.Codec
containsCharacter, decode, encode, getHexForNonAlphanumeric, toHex, toOctal
-
-
-
-
Method Detail
-
encodeCharacter
public java.lang.String encodeCharacter(char[] immune, java.lang.Character c)
Default implementation that should be overridden in specific codecs. Encodes a Character for safe use in an HTML entity field.- Overrides:
encodeCharacter
in classCodec
- Parameters:
immune
-c
- the Character to encode- Returns:
- the encoded Character
-
decodeCharacter
public java.lang.Character decodeCharacter(PushbackString input)
Returns the decoded version of the next character from the input string and advances the current character in the PushbackString. 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. Formats all are legal both with and without semi-colon, upper/lower case: dddd; hhhh; &name;- Overrides:
decodeCharacter
in classCodec
- Parameters:
input
- the Character to decode- Returns:
- the decoded Character
-
-