webwork.util
Class TextUtil

java.lang.Object
  extended bywebwork.util.TextUtil

public class TextUtil
extends java.lang.Object

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

Version:
$Revision: 1.9 $
Author:
Dick Zetterberg (dick@transitor.se)

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, java.lang.String txt, java.lang.String[] strings)
           
static java.lang.String escapeHTML(java.lang.String s)
          Call escapeHTML(s, false)
static java.lang.String escapeHTML(java.lang.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

initMapping

protected static void initMapping()

addMapping

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

escapeHTML

public static final java.lang.String escapeHTML(java.lang.String s)
Call escapeHTML(s, false)


escapeHTML

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

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


Copyright © 2001-2003 WebWork All Rights Reserved.