KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)OctetSeqHelper.java 1.13 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 package org.omg.CORBA;
8
9
10 /**
11 * The Helper for <tt>OctetSeq</tt>. For more information on
12 * Helper files, see <a HREF="doc-files/generatedfiles.html#helper">
13 * "Generated Files: Helper Files"</a>.<P>
14 * org/omg/CORBA/OctetSeqHelper.java
15 * Generated by the IDL-to-Java compiler (portable), version "3.0"
16 * from streams.idl
17 * 13 May 1999 22:41:36 o'clock GMT+00:00
18 *
19 * The class definition has been modified to conform to the following
20 * OMG specifications :
21 * <ul>
22 * <li> ORB core as defined by CORBA 2.3.1
23 * (<a HREF="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
24 * </li>
25 *
26 * <li> IDL/Java Language Mapping as defined in
27 * <a HREF="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
28 * </li>
29 * </ul>
30 */

31
32 public abstract class OctetSeqHelper
33 {
34     private static String JavaDoc _id = "IDL:omg.org/CORBA/OctetSeq:1.0";
35
36     public static void insert (org.omg.CORBA.Any JavaDoc a, byte[] that)
37     {
38     org.omg.CORBA.portable.OutputStream JavaDoc out = a.create_output_stream ();
39     a.type (type ());
40     write (out, that);
41     a.read_value (out.create_input_stream (), type ());
42     }
43
44     public static byte[] extract (org.omg.CORBA.Any JavaDoc a)
45     {
46     return read (a.create_input_stream ());
47     }
48
49     private static org.omg.CORBA.TypeCode JavaDoc __typeCode = null;
50     synchronized public static org.omg.CORBA.TypeCode JavaDoc type ()
51     {
52     if (__typeCode == null)
53         {
54         __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_octet);
55         __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
56         __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.OctetSeqHelper.id (), "OctetSeq", __typeCode);
57         }
58     return __typeCode;
59     }
60
61     public static String JavaDoc id ()
62     {
63     return _id;
64     }
65
66     public static byte[] read (org.omg.CORBA.portable.InputStream JavaDoc istream)
67     {
68     byte value[] = null;
69     int _len0 = istream.read_long ();
70     value = new byte[_len0];
71     istream.read_octet_array (value, 0, _len0);
72     return value;
73     }
74
75     public static void write (org.omg.CORBA.portable.OutputStream JavaDoc ostream, byte[] value)
76     {
77     ostream.write_long (value.length);
78     ostream.write_octet_array (value, 0, value.length);
79     }
80
81 }
82
Popular Tags