org.apache.struts2.views.util
Class TextUtil

java.lang.Object
  extended by org.apache.struts2.views.util.TextUtil

public class TextUtil
extends Object

This class handles HTML escaping of text. It was written and optimized to be as fast as possible.


Field Summary
protected static char[][] _stringChars
          We use arrays of char in the lookup table because it is faster appending this to a StringBuffer than appending a String
protected static int MAX_LENGTH
           
 
Constructor Summary
TextUtil()
           
 
Method Summary
protected static void addMapping(int c, String txt, String[] strings)
           
static String escapeHTML(String s)
          Call escapeHTML(s, false)
static String escapeHTML(String s, boolean escapeEmpty)
          Escape HTML.
protected static void initMapping()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LENGTH

protected static final int MAX_LENGTH
See Also:
Constant Field Values

_stringChars

protected static final char[][] _stringChars
We use arrays of char in the lookup table because it is faster appending this to a StringBuffer than appending a String

Constructor Detail

TextUtil

public TextUtil()
Method Detail

escapeHTML

public static final String escapeHTML(String s)
Call escapeHTML(s, false)


escapeHTML

public static final String escapeHTML(String s,
                                      boolean escapeEmpty)
Escape HTML.

Parameters:
s - string to be escaped
escapeEmpty - if true, then empty string will be escaped.

addMapping

protected static void addMapping(int c,
                                 String txt,
                                 String[] strings)

initMapping

protected static void initMapping()


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.