/**
* 获取webViewCache的下所有的文件长度
* @return
*/
public static long getWebCacheLegth(){
long length = 0;
String path = Environment.getDataDirectory() +"/data/"
+ Config.PACKAGE + "/cache/" +"/webviewCache/";
File file = new File(path);
File[] tempList = file.listFiles();
if(tempList!=null){
for(int i =0 ; i < tempList.length ; i++){
if(tempList[i].isFile()){
//文件
File tempFile = tempList[i];
length += tempFile.length();
Log.i("getWebCacheLegth22222", String.valueOf(tempFile.getName()));
}
if(tempList[i].isDirectory()){
//文件夹
}
}
}
path = Environment.getDataDirectory() + "/data/" + Config.PACKAGE + "/databases/webview.db";
file = new File(path);
length += file.length();
path = Environment.getDataDirectory() + "/data/" + Config.PACKAGE + "/databases/webviewCache.db";
file = new File(path);
length += file.length();
return length;
}
读取androidwebView缓存文件长度
最新推荐文章于 2023-05-16 10:33:44 发布