[5073] in java-interest

home help back first fref pref prev next nref lref last post

Problems reading a file

daemon@ATHENA.MIT.EDU (Charles W. Kann)
Sun Jan 28 03:44:12 1996

From: "Charles W. Kann" <ckann@seas.gwu.edu>
To: java-interest@java.Eng.Sun.COM
Date: Sat, 27 Jan 1996 12:16:38 -0500 (EST)

I am trying to read an input file of data from the site where the java
source exists.  I can open a URL, and read the data from the URL by casting
the URL to an InputData object.  However, if I do that, I wind up having
problems reading data because the IO does not readFully, and when it blocks,
it returns whatever it got to that point  (less than a full line).

So in DataInputStream I found a readFully function which seems to be what
I want.  I can cast into it and get past the compiler, but when I try to 
run the class, I get the following run time error:

java.lang.ClassCastException: java.io.BufferedInputStream
	at Track.Init(Track.java:34)
	at train_main.run(train_main.java:36)
	at java.lang.Thread.run(Thread.java)

I could simply do the same thing as readFully in my class, but I really
wanted was to somehow have a standard readFully available to me.  How
can I use readFully against a file I open using a URL?


Chuck Kann
ckann@seas.gwu.edu
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post