B
Billy
I have a class wich loads data from a InputStream :
public static Image loadmap (InputStream fs)
{
....
}
When I use it with a local filename all works as excpected:
loadmap (new FileInputStream("myfile"));
Now I want to open this file from a webserver using an url as is the
following, but is seems that urlfs passed to loadmap is empty? Any
ideas?
try {
URL url = new URL("http://www.mysite/myfile");
try {
URLConnection con = url.openConnection();
con.connect();
InputStream urlfs;
urlfs = con.getInputStream();
return loadmap (urlfs);
} catch (IOException e) {System.out.println(e);}
} catch (MalformedURLException e) {System.out.println(e);}
public static Image loadmap (InputStream fs)
{
....
}
When I use it with a local filename all works as excpected:
loadmap (new FileInputStream("myfile"));
Now I want to open this file from a webserver using an url as is the
following, but is seems that urlfs passed to loadmap is empty? Any
ideas?
try {
URL url = new URL("http://www.mysite/myfile");
try {
URLConnection con = url.openConnection();
con.connect();
InputStream urlfs;
urlfs = con.getInputStream();
return loadmap (urlfs);
} catch (IOException e) {System.out.println(e);}
} catch (MalformedURLException e) {System.out.println(e);}