com.techventus.server.voice.util
Class ParsingUtil

java.lang.Object
  extended by com.techventus.server.voice.util.ParsingUtil

public abstract class ParsingUtil
extends java.lang.Object

Collection of useful html parsing methods


Constructor Summary
ParsingUtil()
           
 
Method Summary
static java.lang.String htmlEntitiesDecode(java.lang.String s)
          Replaces some speciel htmlEntities with a corresponding String //TODO use Apache commons StringEscapeUtils.unescapeHTML() ?
static int[] jsonIntArrayToIntArray(gvjava.org.json.JSONArray array)
           
static java.util.List<java.lang.Integer> jsonIntArrayToIntegerList(gvjava.org.json.JSONObject settingsJSON, java.util.List<java.lang.Integer> integerList, java.lang.String key)
           
static java.lang.String[] jsonStringArrayToStringArray(gvjava.org.json.JSONArray array)
           
static java.util.List<java.lang.String> jsonStringArrayToStringList(gvjava.org.json.JSONObject settingsJSON, java.util.List<java.lang.String> stringList, java.lang.String key)
           
static java.lang.String removeUninterestingParts(java.lang.String text, java.lang.String startBorder, java.lang.String endBorder, boolean includeBorders)
          Strips the text from the uninteresting parts before and after the interesting part.
static gvjava.org.json.JSONArray stringListToJsonArray(java.util.List<java.lang.String> stringList)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParsingUtil

public ParsingUtil()
Method Detail

removeUninterestingParts

public static final java.lang.String removeUninterestingParts(java.lang.String text,
                                                              java.lang.String startBorder,
                                                              java.lang.String endBorder,
                                                              boolean includeBorders)
Strips the text from the uninteresting parts before and after the interesting part. The return includes borders if includeBorders == true - Returns null when Exception occures

Example:
removeUninterestingParts("Hello Toby , How are you today? Fine.", "How are", "?" , true)
Returns: "How are you today?"

removeUninterestingParts("Hello Joseph, How are you today? Fine.", "How are", "?" , false)
Returns: " you today"

Parameters:
text -
startBorder -
endBorder -
includeBorders -
Returns:

htmlEntitiesDecode

public static java.lang.String htmlEntitiesDecode(java.lang.String s)
Replaces some speciel htmlEntities with a corresponding String //TODO use Apache commons StringEscapeUtils.unescapeHTML() ?

Parameters:
s -
Returns:

jsonIntArrayToIntArray

public static final int[] jsonIntArrayToIntArray(gvjava.org.json.JSONArray array)

jsonStringArrayToStringArray

public static final java.lang.String[] jsonStringArrayToStringArray(gvjava.org.json.JSONArray array)

jsonStringArrayToStringList

public static final java.util.List<java.lang.String> jsonStringArrayToStringList(gvjava.org.json.JSONObject settingsJSON,
                                                                                 java.util.List<java.lang.String> stringList,
                                                                                 java.lang.String key)
                                                                          throws gvjava.org.json.JSONException
Throws:
gvjava.org.json.JSONException

jsonIntArrayToIntegerList

public static final java.util.List<java.lang.Integer> jsonIntArrayToIntegerList(gvjava.org.json.JSONObject settingsJSON,
                                                                                java.util.List<java.lang.Integer> integerList,
                                                                                java.lang.String key)
                                                                         throws gvjava.org.json.JSONException
Throws:
gvjava.org.json.JSONException

stringListToJsonArray

public static final gvjava.org.json.JSONArray stringListToJsonArray(java.util.List<java.lang.String> stringList)
                                                             throws gvjava.org.json.JSONException
Throws:
gvjava.org.json.JSONException