U E D R , A S I H C RSS

JavaHTML Parsing/2011년프로젝트



1.


API Java HTML TEXT를 긁는게 목.

HOW???



2.1.


드.

import java.net.URL;
 import java.net.URLConnection;
 import java.net.MalformedURLException;

 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.BufferedReader;
 import java.io.IOException;

 public class URLConn{
	 
     public static void main(String args[]){
         URL url;//URL 
        URLConnection connection;//URL는 객
        InputStream is;//URL  Stream
         InputStreamReader isr;
         BufferedReader br;
        
         try{
             //URL객당 URL로 다..
             url = new URL("http://www.hufslife.com/");
             connection = url.openConnection();

             //내  InputStream객다..
             is = connection.getInputStream();
             isr = new InputStreamReader(is);
             br = new BufferedReader(isr);

             //내   다..
             String buf = null;
             while(true){
                 buf = br.readLine();
                 if(buf == null) break;
                 System.out.println(buf);
             }
         }catch(MalformedURLException mue){
             System.err.println("못된 URL다. 법 : java URLConn http://hostname/path]");
             System.exit(1);
         }catch(IOException ioe){
             System.err.println("IOException " + ioe);
             ioe.printStackTrace();
             System.exit(1);
         }
     }
 };

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:30
Processing time 0.0070 sec