KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)MaxStreamFormatVersionServiceContext.java 1.8 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 /**
9  * @(#)MaxStreamFormatVersionServiceContext.java 1.8 04/06/21
10  */

11 package com.sun.corba.se.spi.servicecontext;
12
13 import org.omg.IOP.RMICustomMaxStreamFormat JavaDoc;
14 import javax.rmi.CORBA.*;
15 import org.omg.CORBA.SystemException JavaDoc;
16 import org.omg.CORBA_2_3.portable.InputStream JavaDoc;
17 import org.omg.CORBA_2_3.portable.OutputStream JavaDoc;
18 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
19 import com.sun.corba.se.impl.encoding.MarshalInputStream;
20 import com.sun.corba.se.impl.encoding.MarshalOutputStream;
21 import com.sun.corba.se.impl.orbutil.ORBUtility;
22
23 public class MaxStreamFormatVersionServiceContext extends ServiceContext {
24
25     private byte maxStreamFormatVersion;
26
27     // The singleton uses the maximum version indicated by our
28
// ValueHandler.
29
public static final MaxStreamFormatVersionServiceContext singleton
30         = new MaxStreamFormatVersionServiceContext();
31
32     public MaxStreamFormatVersionServiceContext() {
33         maxStreamFormatVersion = ORBUtility.getMaxStreamFormatVersion();
34     }
35
36     public MaxStreamFormatVersionServiceContext(byte maxStreamFormatVersion) {
37         this.maxStreamFormatVersion = maxStreamFormatVersion;
38     }
39
40     public MaxStreamFormatVersionServiceContext(InputStream JavaDoc is,
41                                                 GIOPVersion gv) {
42     super(is, gv) ;
43
44         maxStreamFormatVersion = is.read_octet();
45     }
46
47     public static final int SERVICE_CONTEXT_ID = RMICustomMaxStreamFormat.value;
48     public int getId() { return SERVICE_CONTEXT_ID; }
49
50     public void writeData(OutputStream JavaDoc os) throws SystemException JavaDoc
51     {
52         os.write_octet(maxStreamFormatVersion);
53     }
54     
55     public byte getMaximumStreamFormatVersion()
56     {
57     return maxStreamFormatVersion;
58     }
59
60     public String JavaDoc toString()
61     {
62     return "MaxStreamFormatVersionServiceContext["
63             + maxStreamFormatVersion + "]";
64     }
65 }
66     
67
68
69
70
Popular Tags