KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > spi > servicecontext > UnknownServiceContext


1 /*
2  * @(#)UnknownServiceContext.java 1.15 04/06/21
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.spi.servicecontext;
9
10 import org.omg.CORBA.SystemException JavaDoc;
11 import org.omg.CORBA_2_3.portable.InputStream JavaDoc;
12 import org.omg.CORBA_2_3.portable.OutputStream JavaDoc;
13 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
14 import com.sun.corba.se.spi.servicecontext.ServiceContext ;
15
16 public class UnknownServiceContext extends ServiceContext {
17     public UnknownServiceContext( int id, byte[] data )
18     {
19     this.id = id ;
20     this.data = data ;
21     }
22
23     public UnknownServiceContext( int id, InputStream JavaDoc is )
24     {
25     this.id = id ;
26
27     int len = is.read_long();
28     data = new byte[len];
29     is.read_octet_array(data,0,len);
30     }
31
32     public int getId() { return id ; }
33
34     public void writeData( OutputStream JavaDoc os ) throws SystemException JavaDoc
35     {
36     }
37
38     public void write( OutputStream JavaDoc os , GIOPVersion gv)
39         throws SystemException JavaDoc
40     {
41     os.write_long( id ) ;
42     os.write_long( data.length ) ;
43     os.write_octet_array( data, 0, data.length ) ;
44     }
45
46     public byte[] getData()
47     {
48     return data ;
49     }
50
51     private int id = -1 ;
52     private byte[] data = null ;
53 }
54
55
Popular Tags