[410] in java-interest
writing "structures" to streams...
daemon@ATHENA.MIT.EDU (Steve Dossick)
Tue Jun 20 14:12:31 1995
To: java-interest@java.sun.com
Reply-To: sdossick@cs.columbia.edu
Date: Tue, 20 Jun 1995 13:50:51 -0400
From: Steve Dossick <sdossick@cs.columbia.edu>
Hey all...
We've been playing with using Java/HotJava applets to connect to an
internal data server and return info to the user. Unfortunately, our
server expects us to send a discrete packet of data across the net and then
wait for a response.
In C code, we simply have a structure, which we cast to a (char *) buffer and
write() into the socket.
We'd love to be able to do this in Java, but you can't cast a class to a
bytestream. We end up having to write each piece of the (large) struct
separately. This gets rather tiring for a struct with 15 elements!
Any suggestions? We've thought about implementing a write() method or
something, which knew how to write the struct to a stream, but it seems
redundant to do this for each structure.
I'm hoping I missed something realy simple in the java toolkit :)
Suggestions?
/steve
------------------------------------------------------------------------------
Steve Dossick
Central Research Facilities
Department of Computer Science
Columbia University
(sdossick@cs.columbia.edu)
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com