±Û¾´ÀÌ :¹Ú°æ¼ö 2000³â 5¿ù 25ÀÏ 16:44:16
¾Æ·¡¿Í °°ÀÌ ÄÚµùÇߴµ¥ ÇѱÛÀÌ ±úÁ®¼ ³ª¿É´Ï´Ù.
¾îÂî ¼Ò½º¸¦ °íÄ¡¸é ÇѱÛÀÌ ±úÁöÁö ¾ÊÀ»±î¿ä.
import java.net.*;
import java.io.*;
public class URLRead
{
public static void main(String args[]) throws Exception
{
try
{
if (args.length != 1)
{
System.err.println ("Invalid command parameters");
System.in.read();
System.exit(0);
}
URL url = new URL(args[0]);
InputStream in = url.openStream();
BufferedInputStream bufIn = new BufferedInputStream(in);
for (;;)
{
int data = bufIn.read();
if (data == -1)
break;
else
System.out.print((char)data);
}
}
catch (MalformedURLException mue)
{
System.err.println ("Invalid URL");
}
catch (IOException ioe)
{
System.err.println ("I/O Error - " + ioe);
}
}
}