¼Ò¼³ java.net ¼Ò½ºÄڵ堠URL  01. URLŬ·¡½º·Î ½ºÆ®¸² ¹Þ±â  

URLŬ·¡½º¸¦ ÀÌ¿ëÇØ¼­ ÀÚºÏÀÇ index.htmlÆÄÀÏÀ» °¡Á®¿À´Â ¿¹Á¦

URLTest.java

import java.net.*;
import 
java.io.*;
public class 
URLTest {
  
public static void 
main(String args[]) {
    
try 
{
      URL home  = 
new  URL("http://www.jabook.org:80/index.html"
);
      BufferedReader br;
      String line;
      System.out.println(
"Port: "
+home.getPort());
      System.out.println(
"Protocol: "
+home.getProtocol());
      System.out.println(
"HostName: "
+home.getHost());
      System.out.println(
"File: "
+home.getFile());
      System.out.println(
"Ref: "
+home.getRef());
      br = 
new BufferedReader(new 
InputStreamReader(home.openStream()));
      
while ((line = br.readLine()) != null
) {
        System.out.println(line);
      }
      br.close();
    } 
catch 
(Exception e) {
      System.out.println(
"Exception: " 
+ e);
    }
  }
}

C:\javaExample\16>javac URLTest.java
C:\javaExample\16>java URLTest
Port: 80
Protocol: http
HostName: www.jabook.org
File: /index.html
Ref: null
<html>
<head>
<title>JABOOK(ÀÚºÏ)-ÀÚ¹Ù ¼Ò¼³°°Àº ÀÚ¹Ù º¸¼® ÀÚ¹Ù »þÂî ÀÚ¹Ù ¼Ò¼³ ÀÚ¹Ù ¼Ò¼³ C# 1ºÎ
 ¼Ò¼³ C# 2ºÎ ¼Ò¼³ C# 3ºÎ ¼Ò¼³ C# 4ºÎ</title>
</head>

    <frameset rows="100,*" frameborder=0 border=0>
    <frame src="head.html" name="menuhead" scrolling="no" marginwidth="0
" marginheight="0" target="_self" noresize>
      <frame name="down" src="intro.html" scrolling="auto">
    </frameset>


</html>

URLŬ·¡½º´Â À¥»ó¿¡ Á¸ÀçÇÏ´Â ÀÚ¿ø¿¡ Á¢±ÙÇϰųª, ³×Æ®¿öÅ© »óÀÇ À¯ÀÏÇÑ ÁÖ¼Ò¸¦ ³ªÅ¸³»´Â Ŭ·¡½ºÀÌ´Ù.



jabookÀúÀÚ¸íÇÔ
Á¦¸ñ:¼Ò¼³°°Àº¹Ì´ÏÄÚµå
ÀÛ¼ºÀÚ:Àںϸâ¹ö ±è¿Ï±â