use of com.google.api.client.json.JsonParser in project robospice by stephanenicolas.
the class JsonObjectPersister method readCacheDataFromFile.
// ============================================================================================
// METHODS
// ============================================================================================
@Override
protected T readCacheDataFromFile(File file) throws CacheLoadingException {
try {
JsonParser jsonParser = jsonFactory.createJsonParser(new FileReader(file));
T result = jsonParser.parse(getHandledClass(), null);
jsonParser.close();
return result;
} catch (FileNotFoundException e) {
// Should not occur (we test before if file exists)
// Do not throw, file is not cached
Ln.w("file " + file.getAbsolutePath() + " does not exists", e);
return null;
} catch (Exception e) {
throw new CacheLoadingException(e);
}
}
Aggregations