Android CacheLoadingException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android CacheLoadingException class.

This code example shows how to use the following methods:
    @Override 
    protected T deserializeData(String xml) throws CacheLoadingException {
        try { 
            return serializer.read(getHandledClass(), xml);
        } catch (Exception e) {
            throw new CacheLoadingException(e);
        } 
    } 
 
    @Override 
    protected void saveData(T data, Object cacheKey) throws IOException, CacheSavingException {
        try { 
            serializer.write(data, getCacheFile(cacheKey));
        } catch (Exception e) {
            throw new CacheSavingException("Data was null and could not be serialized in xml");
        } 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
    @Override 
    protected T deserializeData(String json) throws CacheLoadingException {
        try { 
            return mJsonMapper.readValue(json, getHandledClass());
        } catch (Exception e) {
            throw new CacheLoadingException(e);
        } 
    } 
 
    @Override 
    protected void saveData(T data, Object cacheKey) throws IOException, CacheSavingException {
        String resultJson;
        // transform the content in json to store it in the cache 
        resultJson = mJsonMapper.writeValueAsString(data);
 
        // finally store the json in the cache 
        if (!StringUtils.isEmpty(resultJson)) {
            FileUtils.writeStringToFile(getCacheFile(cacheKey), resultJson, CharEncoding.UTF_8);
        } else { 
            throw new CacheSavingException("Data was null and could not be serialized in json");
5
CodeRank
See Code Examples for Android CacheLoadingException Methods: