lingochamp / lingochamp/FileDownloader
有足够空间为什么无法下载呢
@rantianhua is already working on this.
Since Feb 6, 2018.
- Dominant language
- Java
- Stars
- 11.1k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
__topic__: -
du: 5.0.2_CHE-TL00H
full-content: [gid]=5; [errorUrl]=https://miscimg01.jiaoliuqu.com//xzmm1504149545.zip; [exception]=The file is too large to store, breakpoint in bytes: 0, required space in bytes: 3319659, but free space in bytes: 0 [com.liulishuo.filedownloader.download.DownloadLaunchRunnable.a(SourceFile:712), com.liulishuo.filedownloader.download.DownloadLaunchRunnable.run(SourceFile:276), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587), java.lang.Thread.run(Thread.java:831)]; [freeSpace]=14110720; [freeMemSpace]=35082240; [freeSDSpace]=14110720
freeSpace 是将要下载的文件父文件的可用存储空间大小,freeMemSpace是内部存储可用空间大小
freeSDSpace 外部存储可用空间大小
获取各部分可用空间大小代码如下:
/**
* 根据路径获取可用空间大小
*
* @param path
* @return
*/
public static String getFreeSpaceBytes(final String path) {
long freeSpaceBytes = 0;
final StatFs statFs = new StatFs(path);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
freeSpaceBytes = statFs.getAvailableBytes();
} else {
//noinspection deprecation
freeSpaceBytes = statFs.getAvailableBlocks() * (long) statFs.getBlockSize();
}
return freeSpaceBytes + "";
}
/**
* 获取手机内部可用空间大小
*/
public static String getMemFree() {
return getFreeSpaceBytes(Environment.getDataDirectory().getPath());
}
/**
* 获取手机外部存储可用空间大小
*/
public static String getSdFree() {
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
return getFreeSpaceBytes(Environment.getExternalStorageDirectory().getPath());
} else {
return "未装载";
}
}
获取到有足够的可用空间为什么无法下载呢?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.