import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
/**
*
*
*
* */
public class getWebpageContent {
public static void main(String[] args) throws IOException{
URL url=new URL("http://www.google.com");
URLConnection conn = url.openConnection();
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
File file = new File("e://mydoc//aa.html");
FileOutputStream fos=new FileOutputStream(file);
BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(fos));
String str;
while((str=br.readLine()) !=null){
bw.write(str);
bw.newLine();
bw.flush();
}
br.close();
fos.close();
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载
- 1
- 2
- 3
- 4
- 5
前往页