07/06/20 18:43:57
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.URL;
public class getURL{
public static void main(String[] args){
try{
for(int i = 892; i <= 905; i++){
byte[] buf = new byte[8192];
String outfile = Integer.toString(i) + ".jpg";
BufferedOutputStream bos = new BufferedOutputStream(
new FileOutputStream(outfile, false)
);
URL url = new URL("URLリンク(cap.in.coocan.jp) + Integer.toString(i) + ".jpg");
InputStream is = url.openStream();
for(int rs; (rs = is.read(buf)) != -1; ){
bos.write(buf, 0, rs);
}
is.close();
bos.close();
}
}catch(Exception e){
e.printStackTrace();
}
}
}