KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > corba > AnyImplHelper


1 /*
2  * @(#)AnyImplHelper.java 1.12 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  * @(#)AnyImplHelper.java 1.12 03/12/19
9  */

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

18
19 package com.sun.corba.se.impl.corba;
20
21 abstract public class AnyImplHelper
22 {
23     private static String JavaDoc _id = "IDL:omg.org/CORBA/Any:1.0";
24
25     public static void insert (org.omg.CORBA.Any JavaDoc a, org.omg.CORBA.Any JavaDoc that)
26     {
27     org.omg.CORBA.portable.OutputStream JavaDoc out = a.create_output_stream ();
28     a.type (type ());
29     write (out, that);
30     a.read_value (out.create_input_stream (), type ());
31     }
32
33     public static org.omg.CORBA.Any JavaDoc extract (org.omg.CORBA.Any JavaDoc a)
34     {
35     return read (a.create_input_stream ());
36     }
37
38     private static org.omg.CORBA.TypeCode JavaDoc __typeCode = null;
39     synchronized public static org.omg.CORBA.TypeCode JavaDoc type ()
40     {
41     if (__typeCode == null)
42         {
43         __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any);
44         }
45     return __typeCode;
46     }
47
48     public static String JavaDoc id ()
49     {
50     return _id;
51     }
52
53     public static org.omg.CORBA.Any JavaDoc read (org.omg.CORBA.portable.InputStream JavaDoc istream)
54     {
55     return istream.read_any ();
56     }
57
58     public static void write (org.omg.CORBA.portable.OutputStream JavaDoc ostream, org.omg.CORBA.Any JavaDoc value)
59     {
60     ostream.write_any (value);
61     }
62
63 }
64
Popular Tags