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 class
CSAppUtils.DateComapareType
Type to compare dates. -
Constructor Summary
Constructors Constructor Description CSAppUtils()
-
Method Summary
Modifier and Type Method Description static org.json.JSONObject
getJsonFromCacheFile(File file)
To retrieve data from cache.String
getMD5FromString(String value)
To encrypt given value.boolean
getResponseTimeFromCacheFile(File file, long time)
To check if required response within given time window available in cachestatic Calendar
parseDate(String date, String dateFormat, TimeZone timeZone)
Converts the given date to the user's timezone.
-
Constructor Details
-
CSAppUtils
public CSAppUtils()
-
-
Method Details
-
getResponseTimeFromCacheFile
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
To retrieve data from cache.- Parameters:
file
- cache file.- Returns:
- cache data in JSON.
-
getMD5FromString
To encrypt given value.- Parameters:
value
- string- Returns:
- MD5 value
-
parseDate
public static Calendar parseDate(String date, String dateFormat, TimeZone timeZone) throws ParseExceptionConverts the given date to the user's timezone.- Parameters:
date
-String
dateFormat
-String
timeZone
- String- Returns:
- Calendar
- Throws:
ParseException
-
Example :
CSAppUtils.parseDate(dateString, "yyyy-MM-dd'T'HH:mm:ssZ", TimeZone.getTimeZone("GMT"));
-