|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.clearsilver.jsilver.functions.escape.SimpleEscapingFunction
public abstract class SimpleEscapingFunction
Base class to make writing fast, simple escaping functions easy. A simple escaping function is one where each character in the input is treated independently and there is no runtime state. The only decision you make is whether the current character should be escaped into some different string or not. The only serious limitation on using this class it that only low valued characters can be escaped. This is because (for speed) we use an array of escaped strings, indexed by character value. In future this limitation may be lifted if there's a call for it.
Constructor Summary | |
---|---|
protected |
SimpleEscapingFunction()
|
protected |
SimpleEscapingFunction(char[] ESCAPE_CHARS)
Creates an instance to escape the given set of characters. |
Method Summary | |
---|---|
void |
filter(String in,
Appendable out)
Algorithm is as follows: Scan block for contiguous unescaped sequences Append unescaped sequences to output Append escaped string to output (if found) Rinse & Repeat |
protected abstract String |
getEscapeString(char c)
Given one of the escape characters supplied to this instance's constructor, return the escape string for it. |
protected void |
setEscapeChars(char[] ESCAPE_CHARS)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected SimpleEscapingFunction(char[] ESCAPE_CHARS)
protected SimpleEscapingFunction()
Method Detail |
---|
protected void setEscapeChars(char[] ESCAPE_CHARS) throws AssertionError
AssertionError
protected abstract String getEscapeString(char c)
public void filter(String in, Appendable out) throws IOException
filter
in interface TextFilter
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |