本文整理了Java中android.os.Environment.getDownloadCacheDirectory()
方法的一些代码示例,展示了Environment.getDownloadCacheDirectory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.getDownloadCacheDirectory()
方法的具体详情如下:
包路径:android.os.Environment
类名称:Environment
方法名:getDownloadCacheDirectory
暂无
代码示例来源:origin: lingochamp/FileDownloader
public static String getDefaultSaveRootPath() {
if (!TextUtils.isEmpty(defaultSaveRootPath)) {
return defaultSaveRootPath;
}
if (FileDownloadHelper.getAppContext().getExternalCacheDir() == null) {
return Environment.getDownloadCacheDirectory().getAbsolutePath();
} else {
//noinspection ConstantConditions
return FileDownloadHelper.getAppContext().getExternalCacheDir().getAbsolutePath();
}
}
代码示例来源:origin: lingochamp/okdownload
public static String getDefaultSaveRootPath() {
if (!TextUtils.isEmpty(defaultSaveRootPath)) {
return defaultSaveRootPath;
}
if (FileDownloadHelper.getAppContext().getExternalCacheDir() == null) {
return Environment.getDownloadCacheDirectory().getAbsolutePath();
} else {
//noinspection ConstantConditions
return FileDownloadHelper.getAppContext().getExternalCacheDir().getAbsolutePath();
}
}
代码示例来源:origin: huangfangyi/FanXin
/**
* 获取APP文件目录下的cache文件家
* @return
*/
private String getDefaultSaveRootPath(Context applicion) {
if (applicion.getExternalCacheDir() == null) {
return Environment.getDownloadCacheDirectory().getAbsolutePath();
} else {
//noinspection ConstantConditions
return applicion.getExternalCacheDir().getAbsolutePath();
}
}
private void printLog(String tag ,String logMessage){
代码示例来源:origin: 80945540/FreeBook
public String patch(String flie) {
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
//取得SD卡文件路径
return Environment.getExternalStorageDirectory().getAbsolutePath() + "/freeBookDownload/"+flie;
}else{
return Environment.getDownloadCacheDirectory().getAbsolutePath() + "/freeBookDownload/"+flie;
}
}
}
代码示例来源:origin: Over17/UnityOBBDownloader
/**
* Checks whether the filename looks legitimate
*/
public static boolean isFilenameValid(String filename) {
filename = filename.replaceFirst("/+", "/"); // normalize leading
// slashes
return filename.startsWith(Environment.getDownloadCacheDirectory().toString())
|| filename.startsWith(Environment.getExternalStorageDirectory().toString());
}
代码示例来源:origin: xujianhui404/livewallpaper
public static String getCacheDir() {
String path;
if (Environment.getExternalStorageState().equals(Environment.MEDIA_UNMOUNTED)) {
path = Environment.getDownloadCacheDirectory().getAbsolutePath();
} else {
path = Environment.getExternalStorageDirectory().getAbsolutePath();
}
return path;
}
代码示例来源:origin: dengshiwei/AndroidUtils
/**
* 获取SD卡DownloadCache路径
* @return
* SD卡存在返回正常路径;SD卡不存在返回""
*/
public static String getSDCardDownloadCachePath(){
if(isSDCardEnable()){
return Environment.getDownloadCacheDirectory().getAbsolutePath() + File.separator;
}else{
return "";
}
}
代码示例来源:origin: Over17/UnityOBBDownloader
/**
* @return the root of the filesystem containing the given path
*/
public static File getFilesystemRoot(String path) {
File cache = Environment.getDownloadCacheDirectory();
if (path.startsWith(cache.getPath())) {
return cache;
}
File external = Environment.getExternalStorageDirectory();
if (path.startsWith(external.getPath())) {
return external;
}
throw new IllegalArgumentException(
"Cannot determine filesystem root for " + path);
}
代码示例来源:origin: 0xm1nam0/RxCore
public static String getCachePath(String cachePath) {
if (!isSDCardEnable()) return Environment.getDownloadCacheDirectory().getPath() + File.separator + cachePath + File.separator;;
return Environment.getExternalStorageDirectory().getPath() + File.separator + cachePath + File.separator;
}
/**
代码示例来源:origin: dengshiwei/AndroidUtils
/**
* 获取SD卡DownloadCache路径
* @return
* SD卡存在返回正常路径;SD卡不存在返回null
*/
public static File getSDCardDownloadCacheFile(){
if(isSDCardEnable()){
return Environment.getDownloadCacheDirectory();
}else{
return null;
}
}
代码示例来源:origin: wangli135/BlogDemo
sb.append("DownloadCacheDirectory:" + Environment.getDownloadCacheDirectory().getAbsolutePath() + "\n");
sb.append("ExternalStorageDirectory():" + Environment.getExternalStorageDirectory().getAbsolutePath() + "\n");
sb.append("ExternalStoragePublicDirectory:" + Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath() + "\n");
代码示例来源:origin: gigabytedevelopers/FireFiles
public long getPartionSize(int type, boolean isTotal){
Long size = 0L;
switch (type) {
case PARTITION_SYSTEM:
size = getPartionSize(Environment.getRootDirectory().getPath(), isTotal);
break;
case PARTITION_DATA:
size = getPartionSize(Environment.getDataDirectory().getPath(), isTotal);
break;
case PARTITION_CACHE:
size = getPartionSize(Environment.getDownloadCacheDirectory().getPath(), isTotal);
break;
case PARTITION_EXTERNAL:
size = getPartionSize(Environment.getExternalStorageDirectory().getPath(), isTotal);
break;
/*case PARTITION_EMMC:
size = getPartionSize(DIR_EMMC, isTotal);
break;*/
case PARTITION_RAM:
size = getSizeTotalRAM(isTotal);
break;
}
return size;
}
内容来源于网络,如有侵权,请联系作者删除!