本文整理汇总了Java中android.content.Context.getFileStreamPath方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getFileStreamPath方法的具体用法?Java Context.getFileStreamPath怎么用?Java Context.getFileStreamPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.Context
的用法示例。
在下文中一共展示了Context.getFileStreamPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isCacheDataFailure
import android.content.Context; //导入方法依赖的package包/类
/**
* 判断缓存是否已经失效
*/
public static boolean isCacheDataFailure(Context context, String cachefile) {
File data = context.getFileStreamPath(cachefile);
if (!data.exists()) {
return false;
}
long existTime = System.currentTimeMillis() - data.lastModified();
boolean failure = false;
if (TDevice.isWifiOpen()) {
failure = existTime > wifi_cache_time;
} else {
failure = existTime > other_cache_time;
}
return failure;
}
示例2: isCacheDataFailure
import android.content.Context; //导入方法依赖的package包/类
/**
* 判断缓存是否已经失效
*/
public static boolean isCacheDataFailure(Context context, String cachefile) {
File data = context.getFileStreamPath(cachefile);
if (!data.exists()) {
return false;
}
long existTime = System.currentTimeMillis() - data.lastModified();
boolean failure = false;
if (TDevice.getNetworkType() == TDevice.NETTYPE_WIFI) {
failure = existTime > Settings.getInt(Settings.CACHE_OVERTIME_WIFI,30) * 60 * 1000 ? true : false;
} else {
failure = existTime > Settings.getInt(Settings.CACHE_OVERTIME_OTHER,2) * 24 * 60 * 60 * 1000 ? true : false;
}
return failure;
}
示例3: doPrivateDirFileFuzzing
import android.content.Context; //导入方法依赖的package包/类
private static void doPrivateDirFileFuzzing(MethodHookParam param, int index, FileFuzzingSerializableObject fuzzyingObject) {
String fileName = (String)param.args[index];
Context appContext = Hooker.applicationContext;
File localFile = appContext.getFileStreamPath(fileName);
//only create a dummy file if there is no file
if(!localFile.exists()) {
//what file format do we need?
copyCorrectFile(localFile, fuzzyingObject.getFileFormat());
}
}
示例4: loadSavedFilterRules
import android.content.Context; //导入方法依赖的package包/类
public static JSONObject loadSavedFilterRules(Context context, boolean overwrite) throws IOException, DataFormatException, JSONException {
File file = context.getFileStreamPath("rules");
if (!file.exists())
//noinspection ResultOfMethodCallIgnored
file.createNewFile();
byte[] content = Compressor.readFile(file);
if (!overwrite && content.length > 0) {
String data = new String(Compressor.decompress(content), "UTF-8");
return new JSONObject(data);
} else
return new JSONObject().put("rules", new JSONArray());
}
示例5: loadSavedIdentities
import android.content.Context; //导入方法依赖的package包/类
public static JSONObject loadSavedIdentities(Context context, boolean overwrite) throws IOException, DataFormatException, JSONException {
File file = context.getFileStreamPath("identities");
if (!file.exists())
//noinspection ResultOfMethodCallIgnored
file.createNewFile();
byte[] content = Compressor.readFile(file);
if (!overwrite && content.length > 0) {
String data = new String(Compressor.decompress(content), "UTF-8");
return new JSONObject(data);
} else
return new JSONObject().put("identities", new JSONArray());
}
示例6: fileExists
import android.content.Context; //导入方法依赖的package包/类
private static boolean fileExists(Context context, String filename) {
File file = context.getFileStreamPath(filename);
if(file == null || !file.exists()) {
return false;
}
return true;
}
示例7: isExistDataCache
import android.content.Context; //导入方法依赖的package包/类
/**
* 判断缓存是否存在
*
* @param cachefile
* @return
*/
public static boolean isExistDataCache(Context context, String cachefile) {
if (context == null)
return false;
boolean exist = false;
File data = context.getFileStreamPath(cachefile);
if (data.exists())
exist = true;
return exist;
}
示例8: isFileUpdated
import android.content.Context; //导入方法依赖的package包/类
/**
* 检查 files 目录下个某个文件是否已经为最新(比 assets 目录下的新)
*
* @param c
* @param filename
* @return 如果文件比 assets 下的同名文件的时间戳旧,或者文件不存在,则返回 false.
*/
public static boolean isFileUpdated(Context c, String filename) {
File file = c.getFileStreamPath(filename);
if (file == null) {
return false;
}
if (!file.exists()) {
return false;
}
long timestampOfFile = getFileTimestamp(c, filename);
long timestampOfAsset = getBundleTimestamp(c, filename);
return (timestampOfAsset <= timestampOfFile);
}
示例9: isExtractedFromAssetsToFiles
import android.content.Context; //导入方法依赖的package包/类
public static boolean isExtractedFromAssetsToFiles(Context c, String filename) {
File file = c.getFileStreamPath(filename);
if (file == null || !file.exists()) {
if (BuildConfig.DEBUG) {
Log.i(TAG, "Extract no exist file from assets filename = " + filename);
}
return true;
}
// compare file version for extract
return compareDataFileVersion(c, filename);
}
示例10: needSendCache
import android.content.Context; //导入方法依赖的package包/类
private static boolean needSendCache(Context context) {
for (String action : Trakt.ACTIONS) {
String xmlName = Trakt.getXmlName(action);
File xmlFile = context.getFileStreamPath(xmlName);
if (xmlFile != null && xmlFile.exists())
return true;
}
if (Trakt.getFlagSyncPreference(PreferenceManager.getDefaultSharedPreferences(context)) != 0)
return true;
return false;
}
示例11: objectExists
import android.content.Context; //导入方法依赖的package包/类
public static boolean objectExists(Context context, String key){
File file = context.getFileStreamPath(key);
return file.exists();
}
示例12: fv
import android.content.Context; //导入方法依赖的package包/类
public fv(Context context) {
this.c = new fw();
this.d = context.getFileStreamPath(".flurryinstallreceiver.");
ib.a(3, b, "Referrer file name if it exists: " + this.d);
}
示例13: isFileExistent
import android.content.Context; //导入方法依赖的package包/类
private boolean isFileExistent(Context context, String fileName) {
File file = context.getFileStreamPath(fileName);
return (file != null && file.exists());
}
示例14: doesStorageFileExist
import android.content.Context; //导入方法依赖的package包/类
public static boolean doesStorageFileExist(String key, Context context){
File file = context.getFileStreamPath(key);
return file.exists();
}
示例15: getLogsFile
import android.content.Context; //导入方法依赖的package包/类
@NonNull
private static File getLogsFile(@NonNull Context context) {
return context.getFileStreamPath(LOG_FILE_NAME);
}