Mobile SDK Android: EPZString
From ePrize Developers Wiki
Revision as of 23:09, 6 November 2014
Contents |
Overview
The EPZString class is a convenience class for working with strings, as well as a few convenience methods for working with JSONObjects. Though this is a publicly available class in the SDK, you will likely not need to use it, as it is referenced by the core SDK logic for all necessary encoding needs.
Public Methods
encodedString
public static String encodedString(String target)
Returns
String Encoded string of the passed-in value.
capitalize
public static String capitalize(String s)
Returns
String Passed-in value, with first character capitalized.
convertStreamToString
public static String convertStreamToString(InputStream is)
Returns
String value of passed-in InputStream
toMap
public static Map<Object, Object> toMap(JSONObject object) throws JSONException
Convenience method to convert a JSONObject to a Map.
Parameters
object JSONObject to convert to Map<Object, Object>
Returns
Map<Object, Object> of key/value pairs, generated from the passed-in JSONObject.
Throws
JSONException
toList
public static List<Object> toList(JSONArray array) throws JSONException
Convenience method to convert a JSONArray to a List.
Parameters
array JSONArray to convert to List<Object>
Returns
List<Object> of objects from the passed-in JSONArray.
Throws
JSONException
fromJson
public static Object fromJson(Object json) throws JSONException
Generic convenience method that returns an Object by calling the toMap() or toList() method, based on what type of Object is passed in to the method.
Parameters
json Object to convert.
Returns
Object from the passed-in value.
Throws
JSONException