[2566] in java-interest

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

Re: passing object

daemon@ATHENA.MIT.EDU (Thomas Ball)
Wed Oct 4 19:06:06 1995

Date: Wed, 4 Oct 1995 14:22:17 -0700
From: Thomas.Ball@Eng.Sun.COM (Thomas Ball)
To: lliang@bellcore.com
Cc: java-interest@java.Eng.Sun.COM

No, there is not.  Object copying is a hard problem, one many papers have
been and will be written.  There is no generic support for it in Java.

Application-specific object copying is easier -- you have to decant and
recant the object's stateful information by passing it as a stream of
primitive types.  The exception is Strings, which can be passed using
readUTF and writeUTF.  Arrays are best sent by first sending the array
length, followed by each element -- this way the receiver can allocate
the correctly-sized array before initializing each element.  Note that
you also own the burden of synchonization between these objects.

Tom

>  From daemon@java  Tue Oct  3 19:41:03 1995
>  To: java-interest@java
>  Subject: passing object
>  X-Info: To unsubscribe, send 'unsubscribe' to java-interest-request@java.sun.com
>  
>  Is there a generic way to pass objects on a stream? The stream API
>  seems only support the builtin types. 
>  
>  Larry
>  -
>  Note to Sun employees: this is an EXTERNAL mailing list!
>  Info: send 'help' to java-interest-request@java.sun.com
>  
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

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