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

Author:
Tobias Eisentraeger

Constructor Summary
ParsingUtil()
           
 
Method Summary
static java.lang.String htmlEntitiesDecode(java.lang.String s)
          Replaces some speciel htmlEntities with a corresponding String.
static int[] jsonIntArrayToIntArray(gvjava.org.json.JSONArray array)
          Json int array to int 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)
          Converts a Json Integer array to an ArrayList of Integers.
static java.lang.String[] jsonStringArrayToStringArray(gvjava.org.json.JSONArray array)
          Json string array to string 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)
          Json string array to string list.
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)
          String list to JSON array.
 
Methods inherited from class java.lang.Object
equals, 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 - the text
startBorder - the start border
endBorder - the end border
includeBorders - the include borders
Returns:
the string

htmlEntitiesDecode

public static java.lang.String htmlEntitiesDecode(java.lang.String s)
Replaces some speciel htmlEntities with a corresponding String.

Parameters:
s - the HTML Entity in String format
Returns:
the Decoded HTML in String format

jsonIntArrayToIntArray

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

Parameters:
array - the array
Returns:
the int[]

jsonStringArrayToStringArray

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

Parameters:
array - the array
Returns:
the string[]

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
Json string array to string list.

Parameters:
settingsJSON - the settings json
stringList - the string list
key - the key
Returns:
the list
Throws:
gvjava.org.json.JSONException - the jSON exception

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
Converts a Json Integer array to an ArrayList of Integers.

Parameters:
settingsJSON - the settings json
integerList - the integer list
key - the key corresponding to the JSON formatted integer array
Returns:
the list
Throws:
gvjava.org.json.JSONException - the jSON exception

stringListToJsonArray

public static final gvjava.org.json.JSONArray stringListToJsonArray(java.util.List<java.lang.String> stringList)
                                                             throws gvjava.org.json.JSONException
String list to JSON array.

Parameters:
stringList - the string list input
Returns:
the JSON array
Throws:
gvjava.org.json.JSONException - the JSON exception