KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > CORBA > ObjectHelper


1 /*
2  * @(#)ObjectHelper.java 1.11 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 /**
9 * The Helper for <tt>Object</tt>. For more information on
10 * Helper files, see <a HREF="doc-files/generatedfiles.html#helper">
11 * "Generated Files: Helper Files"</a>.<P>
12 */

13  
14 /*
15  * Licensed Materials - Property of IBM
16  * RMI-IIOP v1.0
17  * Copyright IBM Corp. 1998 1999 All Rights Reserved
18  *
19  * US Government Users Restricted Rights - Use, duplication or
20  * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
21  */

22
23 package org.omg.CORBA;
24
25 abstract public class ObjectHelper
26 {
27     private static String JavaDoc _id = "";
28
29     public static void insert (org.omg.CORBA.Any JavaDoc a, org.omg.CORBA.Object JavaDoc that)
30     {
31     org.omg.CORBA.portable.OutputStream JavaDoc out = a.create_output_stream ();
32     a.type (type ());
33     write (out, that);
34     a.read_value (out.create_input_stream (), type ());
35     }
36
37     public static org.omg.CORBA.Object JavaDoc extract (org.omg.CORBA.Any JavaDoc a)
38     {
39     return read (a.create_input_stream ());
40     }
41
42     private static org.omg.CORBA.TypeCode JavaDoc __typeCode = null;
43     synchronized public static org.omg.CORBA.TypeCode JavaDoc type ()
44     {
45     if (__typeCode == null)
46         {
47         __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (TCKind.tk_objref);
48         }
49     return __typeCode;
50     }
51
52     public static String JavaDoc id ()
53     {
54     return _id;
55     }
56
57     public static org.omg.CORBA.Object JavaDoc read (org.omg.CORBA.portable.InputStream JavaDoc istream)
58     {
59     return istream.read_Object ();
60     }
61
62     public static void write (org.omg.CORBA.portable.OutputStream JavaDoc ostream, org.omg.CORBA.Object JavaDoc value)
63     {
64     ostream.write_Object (value);
65     }
66
67 }
68
Popular Tags