Well, about the only thing these two streams have in common is that they
are both INPUT streams. But the DataInputStream descends from a superclass
called FilterInputStream, which implies that the contents of the stream
will be interpretted in a certain way. The DataInputStream helps you interpret
the contents of the stream as text bytes. The ObjectInputStream helps you
interpret things in the stream as objects. And since a string is an
object, it can be passed easily in the ObjectInputStream. If you use
a DataInputStream, you will have to do the work to put the bytes together
into a String.
Hope this helps.
Teri
PIOTR MASIAKOWSKI wrote:
>
> Thanks for the brain surgery - congratulations for Java Heroes.
>
> I just downloaded the source code from the course and I hope it will guide me through my current problem. I played with the code in the handouts to the point that I can have a client (running as an applet) display strings send from server on another machine. I thought it would be trivial to substitute ObjectInputStream for DataInputStream (they take the same InputStream, right?), but when I try to do it, applet goes to sleep. It is probably good time for me to learn more about debugger, but could anybody on this list point out if there is some deeper difference between these two streams?
>
> I also downloaded Visual J++ and I'm thinking of switching from my current CodeWarrior as soon as I get a faster NT machine.
>
> Piotr
-- Teri Roberts email: troberts@lanl.gov CIC-3 phone: (505) 665-2177 Los Alamos National Laboratory fax: (505) 665-5220 Los Alamos, NM 87545