KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > interop > rmi > iiop > StringSeqHelper


1 /**
2  *
3  * Copyright 2004-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.geronimo.interop.rmi.iiop;
19
20 public abstract class StringSeqHelper
21 {
22     public static java.lang.String JavaDoc[] clone
23         (java.lang.String JavaDoc[] _value)
24     {
25         if (_value == null)
26         {
27             return null;
28         }
29         int _16 = _value.length;
30         java.lang.String JavaDoc[] _clone = new java.lang.String JavaDoc[_16];
31         for (int _17 = 0; _17 < _16; _17++)
32         {
33             _clone[_17] = _value[_17];
34         }
35         return _clone;
36     }
37
38     public static java.lang.String JavaDoc[] read
39         (org.omg.CORBA.portable.InputStream JavaDoc _input)
40     {
41         int _18 = _input.read_ulong();
42         java.lang.String JavaDoc[] value = new java.lang.String JavaDoc[_18];
43         for (int _19 = 0; _19 < _18; _19++)
44         {
45             value[_19] = _input.read_string();
46         }
47         return value;
48     }
49
50     public static void write
51         (org.omg.CORBA.portable.OutputStream JavaDoc _output,
52         java.lang.String JavaDoc[] value)
53     {
54         if (value == null)
55         {
56             value = new java.lang.String JavaDoc[0];
57         }
58         int _20 = value.length;
59         _output.write_ulong(_20);
60         for (int _21 = 0; _21 < _20; _21++)
61         {
62             _output.write_string(value[_21]);
63         }
64     }
65
66     public static org.omg.CORBA.TypeCode JavaDoc _type;
67
68     public static org.omg.CORBA.TypeCode JavaDoc type()
69     {
70         if (_type == null)
71         {
72             org.omg.CORBA.ORB JavaDoc orb = org.omg.CORBA.ORB.init();
73             _type = orb.create_sequence_tc(0, orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string));
74         }
75         return _type;
76     }
77
78     public static void insert
79         (org.omg.CORBA.Any JavaDoc any,
80         java.lang.String JavaDoc[] value)
81     {
82         org.omg.CORBA.portable.OutputStream JavaDoc output = any.create_output_stream();
83         write(output, value);
84         any.read_value(output.create_input_stream(), type());
85     }
86
87     public static java.lang.String JavaDoc[] extract
88         (org.omg.CORBA.Any JavaDoc any)
89     {
90         if (! any.type().equal(type()))
91         {
92             throw new org.omg.CORBA.BAD_OPERATION JavaDoc();
93         }
94         return read(any.create_input_stream());
95     }
96
97     public static java.lang.String JavaDoc id()
98     {
99         return "IDL:org/apache/geronimo/interop/rmi/iiop/StringSeq:1.0";
100     }
101 }
102
Popular Tags