fr.opensagres.xdocreport.utils
Class StringEscapeUtils

java.lang.Object
  extended by fr.opensagres.xdocreport.utils.StringEscapeUtils

public class StringEscapeUtils
extends Object


Constructor Summary
StringEscapeUtils()
           
 
Method Summary
static String escapeHtml(String str)
           Escapes the characters in a String using HTML entities.
static void escapeHtml(Writer writer, String string)
           Escapes the characters in a String using HTML entities and writes them to a Writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringEscapeUtils

public StringEscapeUtils()
Method Detail

escapeHtml

public static String escapeHtml(String str)

Escapes the characters in a String using HTML entities.

For example:

"bread" & "butter"

becomes:

"bread" & "butter" .

Supports all known HTML 4.0 entities, including funky accents. Note that the commonly used apostrophe escape character (') is not a legal entity and so is not supported).

Parameters:
str - the String to escape, may be null
Returns:
a new escaped String, null if null string input
See Also:
#unescapeHtml(String), ISO Entities, HTML 3.2 Character Entities for ISO Latin-1, HTML 4.0 Character entity references, HTML 4.01 Character References, HTML 4.01 Code positions

escapeHtml

public static void escapeHtml(Writer writer,
                              String string)
                       throws IOException

Escapes the characters in a String using HTML entities and writes them to a Writer.

For example:

"bread" & "butter"

becomes:

"bread" & "butter" .

Supports all known HTML 4.0 entities, including funky accents. Note that the commonly used apostrophe escape character (') is not a legal entity and so is not supported).

Parameters:
writer - the writer receiving the escaped string, not null
string - the String to escape, may be null
Throws:
IllegalArgumentException - if the writer is null
IOException - when Writer passed throws the exception from calls to the Writer.write(int) methods.
See Also:
escapeHtml(String), #unescapeHtml(String), ISO Entities, HTML 3.2 Character Entities for ISO Latin-1, HTML 4.0 Character entity references, HTML 4.01 Character References, HTML 4.01 Code positions


Copyright © 2013. All rights reserved.