Package com.contentstack.sdk.utility
Class CSAppUtils
- java.lang.Object
-
- com.contentstack.sdk.utility.CSAppUtils
-
public class CSAppUtils extends Object
Utilities for contentstack
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCSAppUtils.DateComapareTypeType to compare dates.
-
Constructor Summary
Constructors Constructor Description CSAppUtils()
-
Method Summary
Modifier and Type Method Description static org.json.JSONObjectgetJsonFromCacheFile(File file)To retrieve data from cache.StringgetMD5FromString(String value)To encrypt given value.booleangetResponseTimeFromCacheFile(File file, long time)To check if required response within given time window available in cachestatic CalendarparseDate(String date, String dateFormat, TimeZone timeZone)Converts the given date to the user's timezone.
-
-
-
Method Detail
-
getResponseTimeFromCacheFile
public boolean getResponseTimeFromCacheFile(File file, long time)
To check if required response within given time window available in cache- Parameters:
file- cache file.time- time- Returns:
- true if cache data available which satisfy given time condition.
-
getJsonFromCacheFile
public static org.json.JSONObject getJsonFromCacheFile(File file)
To retrieve data from cache.- Parameters:
file- cache file.- Returns:
- cache data in JSON.
-
getMD5FromString
public String getMD5FromString(String value)
To encrypt given value.- Parameters:
value- string- Returns:
- MD5 value
-
parseDate
public static Calendar parseDate(String date, String dateFormat, TimeZone timeZone) throws ParseException
Converts the given date to the user's timezone.- Parameters:
date-StringdateFormat-StringtimeZone- String- Returns:
- Calendar
- Throws:
ParseException-
Example :
CSAppUtils.parseDate(dateString, "yyyy-MM-dd'T'HH:mm:ssZ", TimeZone.getTimeZone("GMT"));
-
-