import java.net.*;
import java.io.*;
import java.lang.Exception;
public class getURL {
public static void main(String[] args)throws Exception{
URL myURL=null;
try{
myURL = new URL("http://www.360.cn/index.html");
}catch(MalformedURLException e){
}
InputStream in = myURL.openStream();
byte [] buf = new byte [2048];
FileOutputStream fout = new FileOutputStream("360.html");
int count =0;
while((count = in.read(buf))>0){
fout.write(buf,0,count);
}
}
}
JAVA练习(URL)
最新推荐文章于 2023-04-10 09:02:09 发布