Hello Eric,
If i am right in getting what you are trying to
say then i think the little code i have written below should help you.What this program does is tries to open a URL stream
on a valid URL and downloads the html onto a file and at the same
time displaying the same on the command prompt window.
import java.net.*;
import java.io.*;
public class Yahoo{
public static void main(
String a[]) throws Exception
{
InputStream is = null;
BufferedOutputStream br = new BufferedOutputStream(new FileOutputStream("yahoo.html"));
try{
URL u = new URL("http://www.yahoo.com/index.html");
if( u.openConnection() != null)
{
is = u.openStream();
int i = (int)is.read();
while(i != -1)
{
br.write(i);
System.out.print((char)i);
br.flush();
i = (int)is.read();
}
}
else
{
System.out.println("Not a valid connection");
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
Hope this helps buddy,
Manjunath
[This message has been edited by Manjunath Subramanian (edited September 07, 2001).]