Hi there,
Need help and advice on this. I need to write an applet that read data
from a text file and generates a graph.Below are the 2 methods of reading
the file, which failed.
1)
try{
URL url;
URLConnection urlConn;
url = new URL("http://myhost.com.sg/mytext.txt");
urlConn = url.openConnection();
urlConn.setDoInput(true);
urlConn.setUseCaches(false);
DataInputStream dis = new DataInputStream(urlConn.getInputStream());
String s;
String[][] tmp = new String[25][50] ;
int y = 0;
while ((s=dis.readLine()) != null){
//System.out.println(i);
tmp[y] = s.split("\t");
y++;
}
}catch (IOException e) { //do nothing
}
2)
try{
FileInputStream fis = new FileInputStream(f);
DataInputStream dis = new DataInputStream(fis);
DataInputStream dis = new DataInputStream(urlConn.getInputStream());
String s;
String[][] tmp = new String[25][50] ;
int y = 0;
while ((s=dis.readLine()) != null){
//System.out.println(i);
tmp[y] = s.split("\t");
y++;
}catch (IOException e) { //do nothing
}
Daniel Tahin - 14 Mar 2005 10:29 GMT
What's the problem with the code?
G schrieb:
> Hi there,
> Need help and advice on this. I need to write an applet that read data
[quoted text clipped - 35 lines]
> }catch (IOException e) { //do nothing
> }
Daniel Dyer - 14 Mar 2005 23:16 GMT
When you say it failed, how did it fail? Your catch blocks really
shouldn't be empty, this could be hiding some important information from
you. At the very least add an e.printStackTrace() to each one.
Dan.
> Hi there,
> Need help and advice on this. I need to write an applet that read data
> from a text file and generates a graph.Below are the 2 methods of
> reading
> the file, which failed.

Signature
Daniel Dyer
http://www.footballpredictions.net