///------------- 下面代码用于获取缓存的内容,就不用去本地文件获取内容了 ----by nil-----------------
public boolean getTxtFromCache()
{
String md5Path=MD5Util.md5(tempModel.Book.File.getPath()+"/"+tempModel.Book.File.getLongName());
String fileName=Paths.myLocalCacheDirectory()+"/"+ md5Path+".txt";
File file=new File(fileName);
if(file.exists())
{
getTheString(file);
return true;
}else
{
return false;
}
}
public void getTheString(File file)
{
int size = (int)file.length();
if (size < 0) {
// L.l("==============file is null=======");
}
char[] block = new char[size / 2];
InputStreamReader reader = null;
try {
reader = new InputStreamReader(
new FileInputStream(file),
"UTF-16LE&#
FBReader打开txt优化方案,加入本地格式好后得数据写入和读取
最新推荐文章于 2019-05-03 20:46:20 发布