修复重构loader后ftp模块的bug
This commit is contained in:
@@ -21,6 +21,7 @@ import com.arialyy.aria.core.loader.IRecordHandler;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.BufferedRandomAccessFile;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
import com.arialyy.aria.util.FileUtil;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -32,7 +33,7 @@ import java.io.IOException;
|
||||
* @Date 2019-09-19
|
||||
*/
|
||||
public class RecordHelper {
|
||||
private String TAG = "RecordHelper";
|
||||
private String TAG = CommonUtil.getClassName(getClass());
|
||||
|
||||
private AbsTaskWrapper mWrapper;
|
||||
protected TaskRecord mTaskRecord;
|
||||
@@ -166,6 +167,7 @@ public class RecordHelper {
|
||||
tr.isComplete = false;
|
||||
tr.endLocation = mWrapper.getEntity().getFileSize();
|
||||
} else if (file.length() == mWrapper.getEntity().getFileSize()) {
|
||||
ALog.d(TAG, "文件长度一致,线程完成");
|
||||
tr.isComplete = true;
|
||||
} else {
|
||||
if (file.length() != tr.startLocation) {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||
* Created by lyy on 2017/5/22. 读取配置文件
|
||||
*/
|
||||
public class XMLReader extends DefaultHandler {
|
||||
private final String TAG = "XMLReader";
|
||||
private final String TAG = CommonUtil.getClassName(this);
|
||||
|
||||
private DownloadConfig mDownloadConfig = Configuration.getInstance().downloadCfg;
|
||||
private UploadConfig mUploadConfig = Configuration.getInstance().uploadCfg;
|
||||
@@ -62,13 +62,13 @@ public class XMLReader extends DefaultHandler {
|
||||
|
||||
String value = attributes.getValue("value");
|
||||
switch (qName) {
|
||||
case "getCreatedThreadNum": // 线程数
|
||||
case "threadNum": // 线程数
|
||||
int threadNum = checkInt(value) ? Integer.parseInt(value) : 3;
|
||||
if (threadNum < 1) {
|
||||
ALog.w(TAG, "下载线程数不能小于 1");
|
||||
threadNum = 1;
|
||||
}
|
||||
setField("getCreatedThreadNum", threadNum, ConfigType.DOWNLOAD);
|
||||
setField("threadNum", threadNum, ConfigType.DOWNLOAD);
|
||||
break;
|
||||
case "maxTaskNum": //最大任务书
|
||||
int maxTaskNum = checkInt(value) ? Integer.parseInt(value) : 2;
|
||||
|
||||
@@ -130,27 +130,11 @@ public class DownloadEntity extends AbsNormalEntity implements Parcelable {
|
||||
this.groupHash = groupHash;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后面会删除该方法,请使用{@link #getFilePath()}
|
||||
*/
|
||||
@Deprecated
|
||||
public String getDownloadPath() {
|
||||
return downloadPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFilePath() {
|
||||
return downloadPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后面会删除该方法,请使用{@link #setFilePath(String)}
|
||||
*/
|
||||
@Deprecated
|
||||
public DownloadEntity setDownloadPath(String downloadPath) {
|
||||
return setFilePath(downloadPath);
|
||||
}
|
||||
|
||||
public DownloadEntity setFilePath(String filePath) {
|
||||
this.downloadPath = filePath;
|
||||
return this;
|
||||
|
||||
@@ -98,14 +98,14 @@ public abstract class AbsGroupLoader implements ILoaderVisitor, ILoader {
|
||||
private void initState(Looper looper) {
|
||||
mState = new GroupRunState(getWrapper().getKey(), mListener, mSubQueue);
|
||||
for (DTaskWrapper wrapper : mGTWrapper.getSubTaskWrapper()) {
|
||||
File subFile = new File(wrapper.getEntity().getFilePath());
|
||||
long fileLen = checkFileExists(wrapper.getEntity().getFilePath());
|
||||
if (wrapper.getEntity().getState() == IEntity.STATE_COMPLETE
|
||||
&& subFile.exists()
|
||||
&& subFile.length() == wrapper.getEntity().getFileSize()) {
|
||||
&& fileLen != -1
|
||||
&& fileLen == wrapper.getEntity().getFileSize()) {
|
||||
mState.updateCompleteNum();
|
||||
mCurrentLocation += wrapper.getEntity().getFileSize();
|
||||
} else {
|
||||
if (!subFile.exists()) {
|
||||
if (fileLen == -1) {
|
||||
wrapper.getEntity().setCurrentProgress(0);
|
||||
}
|
||||
wrapper.getEntity().setState(IEntity.STATE_POST_PRE);
|
||||
@@ -120,6 +120,25 @@ public abstract class AbsGroupLoader implements ILoaderVisitor, ILoader {
|
||||
mScheduler = new Handler(looper, SimpleSchedulers.newInstance(mState, mGTWrapper.getKey()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查文件是否存在,需要检查普通任务和分块任务的
|
||||
*
|
||||
* @param filePath 文件路径
|
||||
* @return 文件存在返回文件长度,不存在返回-1
|
||||
*/
|
||||
private long checkFileExists(String filePath) {
|
||||
File temp = new File(filePath);
|
||||
if (temp.exists()) {
|
||||
return temp.length();
|
||||
}
|
||||
File block = new File(String.format(IRecordHandler.SUB_PATH, filePath, 0));
|
||||
if (block.exists()) {
|
||||
return block.length();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public String getKey() {
|
||||
return mGTWrapper.getKey();
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public interface IThreadStateManager extends ILoaderComponent {
|
||||
String DATA_ERROR_INFO = "DATA_ERROR_INFO";
|
||||
String DATA_THREAD_NAME = "DATA_THREAD_NAME";
|
||||
String DATA_THREAD_LOCATION = "DATA_THREAD_LOCATION";
|
||||
String DATA_ADD_LEN = "DATA_ADD_LEN"; // 增加的长度
|
||||
|
||||
/**
|
||||
* 任务是否已经失败
|
||||
@@ -58,6 +59,12 @@ public interface IThreadStateManager extends ILoaderComponent {
|
||||
*/
|
||||
long getCurrentProgress();
|
||||
|
||||
/**
|
||||
* 更新当前进度
|
||||
* @param currentProgress 当前进度
|
||||
*/
|
||||
void updateCurrentProgress(long currentProgress);
|
||||
|
||||
/**
|
||||
* 设置消息循环体
|
||||
*/
|
||||
|
||||
@@ -136,7 +136,6 @@ public abstract class BaseListener<ENTITY extends AbsEntity, TASK_WRAPPER extend
|
||||
mEntity.setConvertSpeed(CommonUtil.formatFileSize(speed < 0 ? 0 : speed) + "/s");
|
||||
}
|
||||
mEntity.setSpeed(speed < 0 ? 0 : speed);
|
||||
|
||||
if (mTaskWrapper.getRequestType() != ITaskWrapper.M3U8_VOD) {
|
||||
mEntity.setPercent((int) (mEntity.getFileSize() <= 0 ? 0
|
||||
: mEntity.getCurrentProgress() * 100 / mEntity.getFileSize()));
|
||||
|
||||
@@ -47,7 +47,7 @@ public class DownloadGroupListener
|
||||
|
||||
@Override
|
||||
public void onSubPre(DownloadEntity subEntity) {
|
||||
handleSpeed(subEntity, 0);
|
||||
handleSubSpeed(subEntity, 0);
|
||||
saveSubState(IEntity.STATE_PRE, subEntity);
|
||||
sendInState2Target(ISchedulers.SUB_PRE, subEntity);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class DownloadGroupListener
|
||||
|
||||
@Override
|
||||
public void onSubStart(DownloadEntity subEntity) {
|
||||
handleSpeed(subEntity, 0);
|
||||
handleSubSpeed(subEntity, 0);
|
||||
saveSubState(IEntity.STATE_RUNNING, subEntity);
|
||||
sendInState2Target(ISchedulers.SUB_START, subEntity);
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class DownloadGroupListener
|
||||
@Override
|
||||
public void onSubStop(DownloadEntity subEntity, long stopLocation) {
|
||||
subEntity.setCurrentProgress(stopLocation);
|
||||
handleSpeed(subEntity, 0);
|
||||
handleSubSpeed(subEntity, 0);
|
||||
saveSubState(IEntity.STATE_STOP, subEntity);
|
||||
saveCurrentLocation();
|
||||
sendInState2Target(ISchedulers.SUB_STOP, subEntity);
|
||||
@@ -75,7 +75,7 @@ public class DownloadGroupListener
|
||||
|
||||
@Override
|
||||
public void onSubComplete(DownloadEntity subEntity) {
|
||||
handleSpeed(subEntity, 0);
|
||||
handleSubSpeed(subEntity, 0);
|
||||
saveSubState(IEntity.STATE_COMPLETE, subEntity);
|
||||
saveCurrentLocation();
|
||||
sendInState2Target(ISchedulers.SUB_COMPLETE, subEntity);
|
||||
@@ -83,7 +83,7 @@ public class DownloadGroupListener
|
||||
|
||||
@Override
|
||||
public void onSubFail(DownloadEntity subEntity, BaseException e) {
|
||||
handleSpeed(subEntity, 0);
|
||||
handleSubSpeed(subEntity, 0);
|
||||
saveSubState(IEntity.STATE_FAIL, subEntity);
|
||||
saveCurrentLocation();
|
||||
sendInState2Target(ISchedulers.SUB_FAIL, subEntity);
|
||||
@@ -95,7 +95,7 @@ public class DownloadGroupListener
|
||||
|
||||
@Override
|
||||
public void onSubCancel(DownloadEntity subEntity) {
|
||||
handleSpeed(subEntity, 0);
|
||||
handleSubSpeed(subEntity, 0);
|
||||
saveSubState(IEntity.STATE_CANCEL, subEntity);
|
||||
saveCurrentLocation();
|
||||
sendInState2Target(ISchedulers.SUB_CANCEL, subEntity);
|
||||
@@ -104,7 +104,7 @@ public class DownloadGroupListener
|
||||
@Override
|
||||
public void onSubRunning(DownloadEntity subEntity, long currentProgress) {
|
||||
|
||||
handleSpeed(subEntity, currentProgress);
|
||||
handleSubSpeed(subEntity, currentProgress);
|
||||
if (System.currentTimeMillis() - mLastSaveTime >= RUN_SAVE_INTERVAL) {
|
||||
saveSubState(IEntity.STATE_RUNNING, subEntity);
|
||||
mLastSaveTime = System.currentTimeMillis();
|
||||
@@ -112,7 +112,7 @@ public class DownloadGroupListener
|
||||
sendInState2Target(ISchedulers.SUB_RUNNING, subEntity);
|
||||
}
|
||||
|
||||
private void handleSpeed(DownloadEntity subEntity, long currentProgress) {
|
||||
private void handleSubSpeed(DownloadEntity subEntity, long currentProgress) {
|
||||
if (currentProgress == 0){
|
||||
subEntity.setSpeed(0);
|
||||
subEntity.setConvertSpeed("0kb/s");
|
||||
|
||||
@@ -152,7 +152,7 @@ public abstract class AbsNormalTTBuilder implements IThreadTaskBuilder {
|
||||
}
|
||||
threadTasks.add(task);
|
||||
}
|
||||
if (currentProgress != 0 && currentProgress != getEntity().getCurrentProgress()) {
|
||||
if (currentProgress != getEntity().getCurrentProgress()) {
|
||||
ALog.d(TAG, String.format("进度修正,当前进度:%s", currentProgress));
|
||||
getEntity().setCurrentProgress(currentProgress);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public interface IRecordHandler extends ILoaderComponent {
|
||||
long SUB_LEN = 1024 * 1024;
|
||||
|
||||
/**
|
||||
* 分块文件路径
|
||||
* 分块文件路径,文件路径.线程id.part
|
||||
*/
|
||||
String SUB_PATH = "%s.%s.part";
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.arialyy.aria.core.manager.ThreadTaskManager;
|
||||
import com.arialyy.aria.core.task.IThreadTask;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.util.FileUtil;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
@@ -71,17 +72,6 @@ public class NormalLoader extends AbsNormalLoader {
|
||||
EventMsgUtil.getDefault().unRegister(this);
|
||||
}
|
||||
|
||||
@Override protected void onPostPre() {
|
||||
super.onPostPre();
|
||||
if (getListener() instanceof IDLoadListener) {
|
||||
((IDLoadListener) getListener()).onPostPre(getEntity().getFileSize());
|
||||
}
|
||||
File file = new File(getEntity().getFilePath());
|
||||
if (file.getParentFile() != null && !file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
///**
|
||||
// * 如果使用"Content-Disposition"中的文件名,需要更新{@link #mTempFile}的路径
|
||||
// */
|
||||
@@ -105,11 +95,21 @@ public class NormalLoader extends AbsNormalLoader {
|
||||
}
|
||||
|
||||
protected void startThreadTask() {
|
||||
|
||||
if (getListener() instanceof IDLoadListener) {
|
||||
((IDLoadListener) getListener()).onPostPre(getEntity().getFileSize());
|
||||
}
|
||||
File file = new File(getEntity().getFilePath());
|
||||
if (file.getParentFile() != null && !file.getParentFile().exists()) {
|
||||
FileUtil.createDir(file.getPath());
|
||||
}
|
||||
mRecord = mRecordHandler.getRecord(getFileSize());
|
||||
mStateManager.setLooper(mRecord, looper);
|
||||
getTaskList().addAll(mTTBuilder.buildThreadTask(mRecord,
|
||||
new Handler(looper, mStateManager.getHandlerCallback())));
|
||||
startThreadNum = mTTBuilder.getCreatedThreadNum();
|
||||
|
||||
mStateManager.updateCurrentProgress(getEntity().getCurrentProgress());
|
||||
if (mStateManager.getCurrentProgress() > 0) {
|
||||
getListener().onResume(mStateManager.getCurrentProgress());
|
||||
} else {
|
||||
|
||||
@@ -61,11 +61,11 @@ public class NormalThreadStateManager implements IThreadStateManager {
|
||||
mLooper = looper;
|
||||
}
|
||||
|
||||
private void checkLooper(){
|
||||
if (mTaskRecord == null){
|
||||
private void checkLooper() {
|
||||
if (mTaskRecord == null) {
|
||||
throw new NullPointerException("任务记录为空");
|
||||
}
|
||||
if (mLooper == null){
|
||||
if (mLooper == null) {
|
||||
throw new NullPointerException("Looper为空");
|
||||
}
|
||||
}
|
||||
@@ -112,9 +112,12 @@ public class NormalThreadStateManager implements IThreadStateManager {
|
||||
}
|
||||
break;
|
||||
case STATE_RUNNING:
|
||||
if (msg.obj instanceof Long) {
|
||||
mProgress += (long) msg.obj;
|
||||
Bundle b = msg.getData();
|
||||
if (b != null) {
|
||||
long len = b.getLong(IThreadStateManager.DATA_ADD_LEN, 0);
|
||||
mProgress += len;
|
||||
}
|
||||
|
||||
break;
|
||||
case STATE_UPDATE_PROGRESS:
|
||||
if (msg.obj == null) {
|
||||
@@ -128,11 +131,8 @@ public class NormalThreadStateManager implements IThreadStateManager {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 不要使用handle更新启动线程的进度,因为有延迟
|
||||
*/
|
||||
void updateProgress(long curProgress) {
|
||||
mProgress = curProgress;
|
||||
@Override public void updateCurrentProgress(long currentProgress) {
|
||||
mProgress = currentProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.exception.BaseException;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -93,6 +94,8 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
|
||||
private void handlerTask() {
|
||||
TaskRecord record = recordHandler.getRecord(wrapper.getEntity().getFileSize());
|
||||
if (record.threadRecords != null
|
||||
&& !TextUtils.isEmpty(record.filePath)
|
||||
&& new File(record.filePath).exists()
|
||||
&& !record.threadRecords.isEmpty()
|
||||
&& record.threadRecords.get(0).isComplete) {
|
||||
ALog.d(TAG, "子任务已完成,key:" + wrapper.getKey());
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
/**
|
||||
* 当前线程的下去区间的进度
|
||||
*/
|
||||
private long mRangeProgress;
|
||||
private long mRangeProgress, mLastRangeProgress;
|
||||
private IThreadTaskAdapter mAdapter;
|
||||
private ThreadRecord mRecord;
|
||||
private String mThreadNmae;
|
||||
@@ -89,6 +89,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
|
||||
isNotNetRetry = AriaConfig.getInstance().getAConfig().isNotNetRetry();
|
||||
mRangeProgress = mRecord.startLocation;
|
||||
mLastRangeProgress = mRangeProgress;
|
||||
updateInterval = config.updateInterval;
|
||||
}
|
||||
|
||||
@@ -304,7 +305,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
}
|
||||
|
||||
@Override public synchronized void updateCompleteState() {
|
||||
ALog.i(TAG, String.format("任务【%s】线程__%s__下载完毕", getTaskWrapper().getKey(), mRecord.threadId));
|
||||
ALog.i(TAG, String.format("任务【%s】线程__%s__完成", getTaskWrapper().getKey(), mRecord.threadId));
|
||||
writeConfig(true, mRecord.endLocation);
|
||||
updateState(IThreadStateManager.STATE_COMPLETE, null);
|
||||
}
|
||||
@@ -334,9 +335,11 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
msg.setData(b);
|
||||
}
|
||||
b.putString(IThreadStateManager.DATA_THREAD_NAME, getThreadName());
|
||||
b.putLong(IThreadStateManager.DATA_ADD_LEN, mRangeProgress - mLastRangeProgress);
|
||||
msg.what = IThreadStateManager.STATE_RUNNING;
|
||||
msg.obj = mRangeProgress;
|
||||
msg.sendToTarget();
|
||||
mLastRangeProgress = mRangeProgress;
|
||||
mLastSendProgressTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@@ -402,13 +405,13 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
if (mFailTimes < RETRY_NUM && needRetry && (NetUtils.isConnected(
|
||||
AriaConfig.getInstance().getAPP())
|
||||
|| isNotNetRetry) && !isBreak()) {
|
||||
ALog.w(TAG, String.format("ts切片【%s】正在重试", getFileName()));
|
||||
ALog.w(TAG, String.format("ts切片【%s】第%s重试", getFileName(), String.valueOf(mFailTimes)));
|
||||
mFailTimes++;
|
||||
FileUtil.deleteFile(mConfig.tempFile);
|
||||
FileUtil.createFile(mConfig.tempFile);
|
||||
ThreadTaskManager.getInstance().retryThread(this);
|
||||
} else {
|
||||
sendFailMsg(null, needRetry);
|
||||
sendFailMsg(null, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,12 +428,12 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
}
|
||||
if (mFailTimes < RETRY_NUM && needRetry && (NetUtils.isConnected(
|
||||
AriaConfig.getInstance().getAPP()) || isNotNetRetry) && !isBreak()) {
|
||||
ALog.w(TAG, String.format("分块【%s】正在重试", getFileName()));
|
||||
ALog.w(TAG, String.format("分块【%s】第%s次重试", getFileName(), String.valueOf(mFailTimes)));
|
||||
mFailTimes++;
|
||||
handleBlockRecord();
|
||||
ThreadTaskManager.getInstance().retryThread(this);
|
||||
} else {
|
||||
sendFailMsg(null, needRetry);
|
||||
sendFailMsg(null, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,7 +496,7 @@ public class ThreadTask implements IThreadTask, IThreadTaskObserver {
|
||||
* 将记录写入到配置文件
|
||||
*
|
||||
* @param isComplete 当前线程是否完成 {@code true}完成
|
||||
* @param record 当前下载进度
|
||||
* @param record 当前进度
|
||||
*/
|
||||
private void writeConfig(boolean isComplete, final long record) {
|
||||
if (mRecord != null) {
|
||||
|
||||
@@ -190,6 +190,27 @@ public class FileUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件夹
|
||||
*/
|
||||
public static boolean deleteDir(File dirFile) {
|
||||
// 如果dir对应的文件不存在,则退出
|
||||
if (!dirFile.exists()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dirFile.isFile()) {
|
||||
return dirFile.delete();
|
||||
} else {
|
||||
|
||||
for (File file : dirFile.listFiles()) {
|
||||
deleteDir(file);
|
||||
}
|
||||
}
|
||||
|
||||
return dirFile.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将对象写入文件
|
||||
*
|
||||
@@ -275,9 +296,14 @@ public class FileUtil {
|
||||
FileOutputStream fos = null;
|
||||
FileChannel foc = null;
|
||||
try {
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
if (file.exists() && file.isDirectory()) {
|
||||
ALog.w(TAG, String.format("路径【%s】是文件夹,将删除该文件夹", targetPath));
|
||||
FileUtil.deleteDir(file);
|
||||
}
|
||||
if (!file.exists()) {
|
||||
FileUtil.createFile(file);
|
||||
}
|
||||
|
||||
fos = new FileOutputStream(targetPath);
|
||||
foc = fos.getChannel();
|
||||
List<FileInputStream> streams = new LinkedList<>();
|
||||
@@ -383,8 +409,8 @@ public class FileUtil {
|
||||
*/
|
||||
public static boolean checkMemorySpace(String path, long fileSize) {
|
||||
File temp = new File(path);
|
||||
if (!temp.exists()){
|
||||
if (!temp.getParentFile().exists()){
|
||||
if (!temp.exists()) {
|
||||
if (!temp.getParentFile().exists()) {
|
||||
FileUtil.createDir(temp.getParentFile().getPath());
|
||||
}
|
||||
path = temp.getParentFile().getPath();
|
||||
|
||||
@@ -142,7 +142,7 @@ public class RecordUtil {
|
||||
int type;
|
||||
if (entity instanceof DownloadEntity) {
|
||||
type = IRecordHandler.TYPE_DOWNLOAD;
|
||||
filePath = ((DownloadEntity) entity).getDownloadPath();
|
||||
filePath = entity.getFilePath();
|
||||
} else if (entity instanceof UploadEntity) {
|
||||
type = IRecordHandler.TYPE_UPLOAD;
|
||||
filePath = entity.getFilePath();
|
||||
|
||||
Reference in New Issue
Block a user