public <T>T retrieve(String key,final Class<T> clazz,boolean isEncrypted,String encryptKey){
  key=safetyKey(key);
  File file=new File(cacheDirectory,key);
  if (isEncrypted) {
    file=fileEncryptor.decrypt(encryptKey,file);
  }
  try {
    T data=jolyglot.fromJson(file,clazz);
    return data;
  }
 catch (  Exception ignore) {
    return null;
  }
 finally {
    if (isEncrypted) {
      file.delete();
    }
  }
}

public < T > T retrieve ( String key , final Class < T > clazz , boolean isEncrypted , String encryptKey ) { key = safetyKey ( key ) ; File file = new File ( cacheDirectory , key ) ; if ( isEncrypted ) { file = fileEncryptor . decrypt ( encryptKey , file ) ; } try { T data = jolyglot . fromJson ( file , clazz ) ; return data ; } catch ( Exception ignore ) { return null ; } finally { if ( isEncrypted ) { file . delete ( ) ; } } }
retrieve the object previously saved .
