Package jodd.net
Class HtmlEncoder
java.lang.Object
jodd.net.HtmlEncoder
Encodes text and URL strings in various ways resulting HTML-safe text.
All methods are
null safe.
Invalid HTML chars are not checked with these methods, they are just
passed as they are.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final char[]private static final char[]private static final char[][]private static final char[][]private static final char[]private static final intprivate static final intprivate static final char[]private static final char[]private static final char[]private static final char[][]private static final char[][] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringEncodes attribute value that will be double quoted.static StringEncodes attribute value that will be single quoted.private static Stringencode(CharSequence text, char[][] buff, int bufflen) static Stringtext(CharSequence text) Encodes a string to HTML-safe text.static Stringxml(CharSequence text) Encodes XML string.
-
Field Details
-
LEN
private static final int LEN- See Also:
-
LEN_XML
private static final int LEN_XML- See Also:
-
TEXT
private static final char[][] TEXT -
ATTR_SQ
private static final char[][] ATTR_SQ -
ATTR_DQ
private static final char[][] ATTR_DQ -
TEXT_XML
private static final char[][] TEXT_XML -
AMP
private static final char[] AMP -
QUOT
private static final char[] QUOT -
APOS
private static final char[] APOS -
LT
private static final char[] LT -
GT
private static final char[] GT -
NBSP
private static final char[] NBSP
-
-
Constructor Details
-
HtmlEncoder
public HtmlEncoder()
-
-
Method Details
-
attributeDoubleQuoted
Encodes attribute value that will be double quoted. In this case, only these entities are encoded:&with&"with"&
-
attributeSingleQuoted
Encodes attribute value that will be single quoted. In this case, only two entities are encoded:&with&'with'&
-
text
Encodes a string to HTML-safe text. The following characters are replaced:&with&<with<>with>with
-
xml
Encodes XML string. In XML there are only 5 predefined character entities. -
encode
-