cn.schoolwow.download.module.progress.flow.PrintDownloadProgressFlow Maven / Gradle / Ivy
The newest version!
package cn.schoolwow.download.module.progress.flow;
import cn.schoolwow.download.domain.progress.DownloadProgress;
import cn.schoolwow.download.module.pool.domain.PoolContext;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
public class PrintDownloadProgressFlow implements BusinessFlow {
@Override
public void executeBusinessFlow(FlowContext flowContext) throws Exception {
PoolContext poolContext = flowContext.checkInstanceData(PoolContext.class);
for(DownloadProgress downloadProgress:poolContext.downloadProgressList){
int no = 0;
System.out.println(String.format(
"|%-3d|%-5s|%-15s|%-5s/%-5s|%02d%%|%-4s",
no++,
downloadProgress.state,
downloadProgress.filePath,
downloadProgress.currentFileSizeFormat,
downloadProgress.totalFileSizeFormat,
downloadProgress.percent,
downloadProgress.downloadSpeedFormat
));
}
if(poolContext.downloadProgressList.isEmpty()){
System.out.println("下载进度列表为空");
}
}
@Override
public String name() {
return "打印下载进度";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy