001 package org.omg.IOP;
002
003
004 /**
005 * Generated from IDL struct "ServiceContext".
006 *
007 * @author JacORB IDL compiler V 2.3.0 (JBoss patch 6), 06-Jun-2007
008 * @version generated at Sep 6, 2011 5:12:32 AM
009 */
010
011 public final class ServiceContextHelper
012 {
013 private static org.omg.CORBA.TypeCode _type = null;
014 public static org.omg.CORBA.TypeCode type ()
015 {
016 if (_type == null)
017 {
018 _type = org.omg.CORBA.ORB.init().create_struct_tc(org.omg.IOP.ServiceContextHelper.id(),"ServiceContext",new org.omg.CORBA.StructMember[]{new org.omg.CORBA.StructMember("context_id", org.omg.IOP.ServiceIdHelper.type(), null),new org.omg.CORBA.StructMember("context_data", org.omg.CORBA.ORB.init().create_sequence_tc(0, org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(10))), null)});
019 }
020 return _type;
021 }
022
023 public static void insert (final org.omg.CORBA.Any any, final org.omg.IOP.ServiceContext s)
024 {
025 any.type(type());
026 write( any.create_output_stream(),s);
027 }
028
029 public static org.omg.IOP.ServiceContext extract (final org.omg.CORBA.Any any)
030 {
031 return read(any.create_input_stream());
032 }
033
034 public static String id()
035 {
036 return "IDL:omg.org/IOP/ServiceContext:1.0";
037 }
038 public static org.omg.IOP.ServiceContext read (final org.omg.CORBA.portable.InputStream in)
039 {
040 org.omg.IOP.ServiceContext result = new org.omg.IOP.ServiceContext();
041 result.context_id=in.read_ulong();
042 int _lresult_context_data4 = in.read_long();
043 try
044 {
045 int x = in.available();
046 if ( x > 0 && _lresult_context_data4 > x )
047 {
048 throw new org.omg.CORBA.MARSHAL("Sequence length too large. Only " + x + " available and trying to assign " + _lresult_context_data4);
049 }
050 }
051 catch (java.io.IOException e)
052 {
053 }
054 result.context_data = new byte[_lresult_context_data4];
055 in.read_octet_array(result.context_data,0,_lresult_context_data4);
056 return result;
057 }
058 public static void write (final org.omg.CORBA.portable.OutputStream out, final org.omg.IOP.ServiceContext s)
059 {
060 out.write_ulong(s.context_id);
061
062 out.write_long(s.context_data.length);
063 out.write_octet_array(s.context_data,0,s.context_data.length);
064 }
065 }