KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > ior > iiop > CodeSetsComponentImpl


1 /*
2  * @(#)CodeSetsComponentImpl.java 1.24 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.impl.ior.iiop;
9
10 import org.omg.CORBA_2_3.portable.InputStream JavaDoc ;
11 import org.omg.CORBA_2_3.portable.OutputStream JavaDoc ;
12
13 import com.sun.corba.se.spi.ior.TaggedComponentBase ;
14
15 import com.sun.corba.se.spi.ior.iiop.CodeSetsComponent ;
16
17 import org.omg.IOP.TAG_CODE_SETS JavaDoc ;
18
19 import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
20 import com.sun.corba.se.impl.encoding.MarshalOutputStream ;
21 import com.sun.corba.se.impl.encoding.MarshalInputStream ;
22
23 /**
24  * @author
25  */

26 public class CodeSetsComponentImpl extends TaggedComponentBase
27     implements CodeSetsComponent
28 {
29     CodeSetComponentInfo csci ;
30  
31     public boolean equals( Object JavaDoc obj )
32     {
33     if (!(obj instanceof CodeSetsComponentImpl))
34         return false ;
35
36     CodeSetsComponentImpl other = (CodeSetsComponentImpl)obj ;
37
38     return csci.equals( other.csci ) ;
39     }
40
41     public int hashCode()
42     {
43     return csci.hashCode() ;
44     }
45
46     public String JavaDoc toString()
47     {
48     return "CodeSetsComponentImpl[csci=" + csci + "]" ;
49     }
50
51     public CodeSetsComponentImpl()
52     {
53         // Uses our default code sets (see CodeSetComponentInfo)
54
csci = new CodeSetComponentInfo() ;
55     }
56
57     public CodeSetsComponentImpl( InputStream JavaDoc is )
58     {
59     csci = new CodeSetComponentInfo() ;
60     csci.read( (MarshalInputStream)is ) ;
61     }
62
63     public CodeSetsComponentImpl(com.sun.corba.se.spi.orb.ORB orb)
64     {
65         if (orb == null)
66             csci = new CodeSetComponentInfo();
67         else
68             csci = orb.getORBData().getCodeSetComponentInfo();
69     }
70     
71     public CodeSetComponentInfo getCodeSetComponentInfo()
72     {
73     return csci ;
74     }
75
76     public void writeContents(OutputStream JavaDoc os)
77     {
78     csci.write( (MarshalOutputStream)os ) ;
79     }
80     
81     public int getId()
82     {
83     return TAG_CODE_SETS.value ; // 1 in CORBA 2.3.1 13.6.3
84
}
85 }
86
Popular Tags