代码语言:javascript复制
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class TextFile {
// 验证表单
public static void main(String[] args) throws Exception{
List<String> list = null;
List<String> strs = new ArrayList<>();
for (int i = 0; i < list.size(); i ) {
printSchedule( (i 1)*100/list.size());
if(!"N".equals(getFlile(list.get(i)))){
strs.add(getFlile(list.get(i)));
}
}
System.out.println("n" "不能下载地址列表:" strs.toString());
}
public static String getFlile(String filepath)throws Exception{
URL pathUrl = new URL(filepath);
HttpURLConnection urlcon = (HttpURLConnection) pathUrl.openConnection();
if(urlcon.getResponseCode()>=400){
return filepath;
}
return "N";
}
private static int TOTLE_LENGTH = 100;
public static void printSchedule(int percent){
for (int i = 0; i < TOTLE_LENGTH 10; i ) {
System.out.print("b");
}
int now = TOTLE_LENGTH * percent / 100;
for (int i = 0; i < now; i ) {
System.out.print(">");
}
for (int i = 0; i < TOTLE_LENGTH - now; i ) {
System.out.print(" ");
}
System.out.print(" " percent "%");
}
}
本文由 小马哥 创作,采用 知识共享署名4.0 国际许可协议进行许可 本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名 最后编辑时间为: 2020/07/07 23:04