本文整理匯總了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);
}