자바 웹 페이지 내용 복사
4228 단어 자바 웹 페이지 내용 복사
- /**
- * “www.baidu.com” test.html 。 , :
- *
- * @author Administrator
- *
- */
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.InputStreamReader;
- import java.io.PrintWriter;
- import java.net.MalformedURLException;
- import java.net.URL;
-
- public class test8 {
-
- /**
- * @param args
- * @throws IOException
- */
- public static void main(String[] args) throws IOException {
- // TODO Auto-generated method stub
- URL url=new URL("http://www.searchnu.com/406");
- BufferedReader in=new BufferedReader(new InputStreamReader(url.openStream()));
- String inString;
- File outfile=new File("test.html");
- PrintWriter out=new PrintWriter(new FileWriter(outfile));
- while((inString=in.readLine())!=null)
- {
- out.println(inString);
- }
- in.close();
- out.close();
- }
-
- }