Java
입력된 주소의 html문서를 모니터 출력 및 txt..
_침묵_
2007. 9. 22. 07:27
import java.io.*; import java.net.*; public class ViewURL { public static void main(String[] args) { new ViewURL(args[0]); } ViewURL(String strURL) { URL myURL; InputStream is; BufferedReader br; String data; FileWriter writer = null; try { myURL = newURL(strURL); is = myURL.openStream(); br = new BufferedReader(new InputStreamReader(is)); writer = new FileWriter("output_HTML.txt"); while ((data = br.readLine()) != null) { System.out.println(data); writer.write(data+"\n"); } } catch (MalformedURLException e){} catch (IOException e) { System.out.println("파일로 출력할 수 없습니다."); } catch (Exception e){} finally { try { writer.close(); } catch (Exception e){} } } }