You've closed it, and try and continue to read from it, which is causing the
error.
See below

> import java.io.*;
> import java.net.*;
>
> public class URLReader {
>         public static void main(String[] args) throws Exception {
>                 URL php = new URL("http://www.php.net/");
>                 BufferedReader in = new BufferedReader(
>                                         new InputStreamReader(
>                                                 php.openStream()));
>                 String inputLine;
>
>                 while((inputLine = in.readLine()) != null) {
>                         System.out.println(inputLine);
>>>>>                        in.close();
remove this
>                 }
                  in.close();
add it back in here
>         }
> }
>
> but I got
> <HTML>
> java.io.IOException: Stream closed
>         at java.io.BufferedReader.readLine(BufferedReader.java)
>         at URLReader.main(URLReader.java:14)

Thor HW

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to