01: /*
02: * Copyright 2002-2004 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun in the LICENSE file that accompanied this code.
10: *
11: * This code is distributed in the hope that it will be useful, but WITHOUT
12: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14: * version 2 for more details (a copy is included in the LICENSE file that
15: * accompanied this code).
16: *
17: * You should have received a copy of the GNU General Public License version
18: * 2 along with this work; if not, write to the Free Software Foundation,
19: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any questions.
24: */
25:
26: /**
27: * @(#)MaxStreamFormatVersionComponentImpl.java 1.17 07/05/05
28: */package com.sun.corba.se.impl.ior.iiop;
29:
30: import org.omg.IOP.TAG_RMI_CUSTOM_MAX_STREAM_FORMAT;
31:
32: import org.omg.CORBA_2_3.portable.OutputStream;
33:
34: import javax.rmi.CORBA.Util;
35: import javax.rmi.CORBA.ValueHandler;
36: import javax.rmi.CORBA.ValueHandlerMultiFormat;
37:
38: import com.sun.corba.se.impl.orbutil.ORBUtility;
39:
40: import com.sun.corba.se.spi.ior.TaggedComponentBase;
41:
42: import com.sun.corba.se.spi.ior.iiop.MaxStreamFormatVersionComponent;
43:
44: // Java to IDL ptc 02-01-12 1.4.11
45: // TAG_RMI_CUSTOM_MAX_STREAM_FORMAT
46: public class MaxStreamFormatVersionComponentImpl extends
47: TaggedComponentBase implements MaxStreamFormatVersionComponent {
48: private byte version;
49:
50: public static final MaxStreamFormatVersionComponentImpl singleton = new MaxStreamFormatVersionComponentImpl();
51:
52: public boolean equals(Object obj) {
53: if (!(obj instanceof MaxStreamFormatVersionComponentImpl))
54: return false;
55:
56: MaxStreamFormatVersionComponentImpl other = (MaxStreamFormatVersionComponentImpl) obj;
57:
58: return version == other.version;
59: }
60:
61: public int hashCode() {
62: return version;
63: }
64:
65: public String toString() {
66: return "MaxStreamFormatVersionComponentImpl[version=" + version
67: + "]";
68: }
69:
70: public MaxStreamFormatVersionComponentImpl() {
71: version = ORBUtility.getMaxStreamFormatVersion();
72: }
73:
74: public MaxStreamFormatVersionComponentImpl(byte streamFormatVersion) {
75: version = streamFormatVersion;
76: }
77:
78: public byte getMaxStreamFormatVersion() {
79: return version;
80: }
81:
82: public void writeContents(OutputStream os) {
83: os.write_octet(version);
84: }
85:
86: public int getId() {
87: return TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value;
88: }
89: }
|