public static ArrayList<String>getSubURLs(String urlString){
ArrayList<String>list = new ArrayList<>();
try{java.net.URL url =new java.net.URL(urlString);
Scanner input =new Scanner(url.openStream());
int current = 0;
while(input.hasNext()){
String line = input.nextLine();
current =line.indexOf("http",current);
while(current>0){
int endIndex= line.indexOf("\",current);
if(endIndex > 0){
list.add(line.substring(current,endIndex));
current = line.indexOf("http:",endIndex);
}
else
current = -1;
}
}
}
}
求大神指教每一行的意思,注意是每一行,采纳必有谢谢!
相关分类