Possible to take URL as the source of a file?

As in the topic, is it possible to define a file using a source from the internet?
For example:
String path = “http://www.source.com/file.txt”;
File newFile = new File(“path”);

I tried it and it didn’t work. So what’s the prefix for a http path?

Thanks very much!

No, you have to use an URL and URLConnection.

But, just for the record, what is the link with jogl?


URL url = new URL("http://www.something.com/file.txt");
InputStream inStream = url.openStream();
InputStreamReader reader = new InputStreamReader( inStream );
BufferedReader bReader = new BufferedReader( reader );
String str;
while ((str = bReader) != null) {
   // what ever...
}

You should download the JDR documentation.

You can find it in here…

http://java.sun.com/j2se/1.5.0/download.jsp

[quote]No, you have to use an URL and URLConnection.

But, just for the record, what is the link with jogl?
[/quote]
Thank you! Well, I’m doing a project with displaying 3D stuff and I’m done. But my program takes inputs from a .txt file. So when I put my project online, I need to specify the URL for the input file.

thank you mustang :slight_smile: