< prev index next >

src/java.rmi/share/classes/java/rmi/server/RemoteObject.java

Print this page




 342      * <code>writeObject</code> on the stream instance
 343      *
 344      * <li>the external ref type name of the nested remote reference,
 345      * which must be <code>"UnicastRef2"</code>,
 346      * written by {@link java.io.ObjectOutput#writeUTF(String)}
 347      *
 348      * <li>the external form of the nested remote reference,
 349      * written by invoking its <code>writeExternal</code> method
 350      * with the stream instance
 351      * (see the description of the external form for
 352      * <code>"UnicastRef2"</code> above)
 353      *
 354      * </ul>
 355      *
 356      * <p>For <code>"UnicastServerRef"</code> and
 357      * <code>"UnicastServerRef2"</code>, no data is written by the
 358      * <code>writeExternal</code> method or read by the
 359      * <code>readExternal</code> method.
 360      */
 361     private void writeObject(java.io.ObjectOutputStream out)
 362         throws java.io.IOException, java.lang.ClassNotFoundException
 363     {
 364         if (ref == null) {
 365             throw new java.rmi.MarshalException("Invalid remote object");
 366         } else {
 367             String refClassName = ref.getRefClass(out);
 368             if (refClassName == null || refClassName.length() == 0) {
 369                 /*
 370                  * No reference class name specified, so serialize
 371                  * remote reference.
 372                  */
 373                 out.writeUTF("");
 374                 out.writeObject(ref);
 375             } else {
 376                 /*
 377                  * Built-in reference class specified, so delegate
 378                  * to reference to write out its external form.
 379                  */
 380                 out.writeUTF(refClassName);
 381                 ref.writeExternal(out);
 382             }




 342      * <code>writeObject</code> on the stream instance
 343      *
 344      * <li>the external ref type name of the nested remote reference,
 345      * which must be <code>"UnicastRef2"</code>,
 346      * written by {@link java.io.ObjectOutput#writeUTF(String)}
 347      *
 348      * <li>the external form of the nested remote reference,
 349      * written by invoking its <code>writeExternal</code> method
 350      * with the stream instance
 351      * (see the description of the external form for
 352      * <code>"UnicastRef2"</code> above)
 353      *
 354      * </ul>
 355      *
 356      * <p>For <code>"UnicastServerRef"</code> and
 357      * <code>"UnicastServerRef2"</code>, no data is written by the
 358      * <code>writeExternal</code> method or read by the
 359      * <code>readExternal</code> method.
 360      */
 361     private void writeObject(java.io.ObjectOutputStream out)
 362         throws java.io.IOException
 363     {
 364         if (ref == null) {
 365             throw new java.rmi.MarshalException("Invalid remote object");
 366         } else {
 367             String refClassName = ref.getRefClass(out);
 368             if (refClassName == null || refClassName.length() == 0) {
 369                 /*
 370                  * No reference class name specified, so serialize
 371                  * remote reference.
 372                  */
 373                 out.writeUTF("");
 374                 out.writeObject(ref);
 375             } else {
 376                 /*
 377                  * Built-in reference class specified, so delegate
 378                  * to reference to write out its external form.
 379                  */
 380                 out.writeUTF(refClassName);
 381                 ref.writeExternal(out);
 382             }


< prev index next >