org.htmlcleaner
Class Utils

java.lang.Object
  extended by org.htmlcleaner.Utils

public class Utils
extends java.lang.Object

Common utilities.

Created by: Vladimir Nikic
Date: November, 2006.


Constructor Summary
Utils()
           
 
Method Summary
static void appendAmpersandEscapedAttribute(java.lang.StringBuilder writer, java.lang.String attributeName, java.util.Map<java.lang.String,java.lang.String> tagAtttributes)
           
static void appendEscapedAttribute(java.lang.Appendable writer, java.lang.String attributeName, java.util.Map<java.lang.String,java.lang.String> tagAtttributes)
           
static java.lang.String escapeXml(java.lang.String s, boolean advanced, boolean recognizeUnicodeChars, boolean translateSpecialEntities)
          Escapes XML string.
static java.lang.String escapeXmlChars(java.lang.String s)
           
static int indexOfIgnoreCase(java.lang.String searchableString, java.lang.String startString, java.lang.String endString, int fromIndex)
          Returns the index within the seachable string of the first occurrence of the concatenated start and end substring.
static boolean isHexadecimalDigit(char ch)
           
static java.lang.String ltrim(java.lang.String s)
          Trims specified string from left.
static java.lang.String ltrimNewline(java.lang.String s)
          Trims specified string from left and stop at \n character
static java.lang.StringBuffer readUrl(java.net.URL url, java.lang.String charset)
          Reads content from the specified URL with specified charset into string
static java.lang.String rtrim(java.lang.String s)
          Trims specified string from right.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

ltrim

public static java.lang.String ltrim(java.lang.String s)
Trims specified string from left.

Parameters:
s -

rtrim

public static java.lang.String rtrim(java.lang.String s)
Trims specified string from right.

Parameters:
s -

ltrimNewline

public static java.lang.String ltrimNewline(java.lang.String s)
Trims specified string from left and stop at \n character

Parameters:
s -

readUrl

public static java.lang.StringBuffer readUrl(java.net.URL url,
                                             java.lang.String charset)
                                      throws java.io.IOException
Reads content from the specified URL with specified charset into string

Parameters:
url -
charset -
Throws:
java.io.IOException

isHexadecimalDigit

public static boolean isHexadecimalDigit(char ch)

escapeXml

public static java.lang.String escapeXml(java.lang.String s,
                                         boolean advanced,
                                         boolean recognizeUnicodeChars,
                                         boolean translateSpecialEntities)
Escapes XML string.


escapeXmlChars

public static java.lang.String escapeXmlChars(java.lang.String s)

appendAmpersandEscapedAttribute

public static void appendAmpersandEscapedAttribute(java.lang.StringBuilder writer,
                                                   java.lang.String attributeName,
                                                   java.util.Map<java.lang.String,java.lang.String> tagAtttributes)

appendEscapedAttribute

public static void appendEscapedAttribute(java.lang.Appendable writer,
                                          java.lang.String attributeName,
                                          java.util.Map<java.lang.String,java.lang.String> tagAtttributes)
                                   throws java.io.IOException
Throws:
java.io.IOException

indexOfIgnoreCase

public static int indexOfIgnoreCase(java.lang.String searchableString,
                                    java.lang.String startString,
                                    java.lang.String endString,
                                    int fromIndex)
Returns the index within the seachable string of the first occurrence of the concatenated start and end substring. The end substring is matched ignoring case considerations.

Parameters:
searchableString - the searchable string
startString - the start string which should be searched in exact case mode
endString - the end string which should be searched in ignore case mode
fromIndex - the index from which to start the search.
Returns:
the index within this string of the first occurrence of the specified substring, starting at the specified index.