helma.util
Class HtmlEncoder

java.lang.Object
  extended by helma.util.HtmlEncoder

public final class HtmlEncoder
extends java.lang.Object

This is a utility class to encode special characters and do formatting for HTML output.


Constructor Summary
HtmlEncoder()
           
 
Method Summary
static java.lang.String encode(java.lang.String str)
          Do "smart" encodging on a string.
static void encode(java.lang.String str, java.lang.StringBuffer ret)
          Do "smart" encodging on a string.
static void encode(java.lang.String str, java.lang.StringBuffer ret, boolean paragraphs, java.util.Set allowedTags)
          Do "smart" encodging on a string.
static java.lang.String encodeAll(java.lang.String str)
           
static void encodeAll(java.lang.String str, java.lang.StringBuffer ret)
           
static void encodeAll(java.lang.String str, java.lang.StringBuffer ret, boolean encodeNewline)
           
static java.lang.String encodeFormValue(java.lang.String str)
           
static void encodeFormValue(java.lang.String str, java.lang.StringBuffer ret)
           
static java.lang.String encodeXml(java.lang.String str)
           
static void encodeXml(java.lang.String str, java.lang.StringBuffer ret)
           
static void main(java.lang.String[] args)
           
static java.lang.String printCharRange(int from, int to)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlEncoder

public HtmlEncoder()
Method Detail

encode

public static final java.lang.String encode(java.lang.String str)
Do "smart" encodging on a string. This means that valid HTML entities and tags, Helma macros and HTML comments are passed through unescaped, while other occurrences of '<', '>' and '&' are encoded to HTML entities.


encode

public static final void encode(java.lang.String str,
                                java.lang.StringBuffer ret)
Do "smart" encodging on a string. This means that valid HTML entities and tags, Helma macros and HTML comments are passed through unescaped, while other occurrences of '<', '>' and '&' are encoded to HTML entities.


encode

public static final void encode(java.lang.String str,
                                java.lang.StringBuffer ret,
                                boolean paragraphs,
                                java.util.Set allowedTags)
Do "smart" encodging on a string. This means that valid HTML entities and tags, Helma macros and HTML comments are passed through unescaped, while other occurrences of '<', '>' and '&' are encoded to HTML entities.

Parameters:
str - the string to encode
ret - the string buffer to encode to
paragraphs - if true use p tags for paragraphs, otherwise just use br's
allowedTags - a set containing the names of allowed tags as strings. All other tags will be escaped

encodeFormValue

public static final java.lang.String encodeFormValue(java.lang.String str)

encodeFormValue

public static final void encodeFormValue(java.lang.String str,
                                         java.lang.StringBuffer ret)

encodeAll

public static final java.lang.String encodeAll(java.lang.String str)

encodeAll

public static final void encodeAll(java.lang.String str,
                                   java.lang.StringBuffer ret)

encodeAll

public static final void encodeAll(java.lang.String str,
                                   java.lang.StringBuffer ret,
                                   boolean encodeNewline)

encodeXml

public static final java.lang.String encodeXml(java.lang.String str)
Parameters:
str - ...
Returns:
...

encodeXml

public static final void encodeXml(java.lang.String str,
                                   java.lang.StringBuffer ret)
Parameters:
str - ...
ret - ...

printCharRange

public static java.lang.String printCharRange(int from,
                                              int to)

main

public static void main(java.lang.String[] args)


Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.