Message_1_2.java revision 608:7e06bf1dcb09
129088Smarkm/* 229088Smarkm * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. 329088Smarkm * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 429088Smarkm * 529088Smarkm * This code is free software; you can redistribute it and/or modify it 629088Smarkm * under the terms of the GNU General Public License version 2 only, as 729088Smarkm * published by the Free Software Foundation. Oracle designates this 829088Smarkm * particular file as subject to the "Classpath" exception as provided 929088Smarkm * by Oracle in the LICENSE file that accompanied this code. 1029088Smarkm * 1129088Smarkm * This code is distributed in the hope that it will be useful, but WITHOUT 1229088Smarkm * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1329088Smarkm * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1429088Smarkm * version 2 for more details (a copy is included in the LICENSE file that 1529088Smarkm * accompanied this code). 1629088Smarkm * 1729088Smarkm * You should have received a copy of the GNU General Public License version 1829088Smarkm * 2 along with this work; if not, write to the Free Software Foundation, 1929088Smarkm * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2029088Smarkm * 2129088Smarkm * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2229088Smarkm * or visit www.oracle.com if you need additional information or have any 2329088Smarkm * questions. 2429088Smarkm */ 2529088Smarkmpackage com.sun.corba.se.impl.protocol.giopmsgheaders; 2629088Smarkm 2729088Smarkmimport java.nio.ByteBuffer; 2829088Smarkm 2929088Smarkmimport com.sun.corba.se.spi.ior.iiop.GIOPVersion; 3029088Smarkm 3129088Smarkmpublic class Message_1_2 extends Message_1_1 3229088Smarkm{ 3329088Smarkm protected int request_id = (int) 0; 34114630Sobrien 3529088Smarkm Message_1_2() {} 3629181Smarkm 3731622Scharnier Message_1_2(int _magic, GIOPVersion _GIOP_version, byte _flags, 38114630Sobrien byte _message_type, int _message_size) { 39114630Sobrien 40114630Sobrien super(_magic, 4129088Smarkm _GIOP_version, 4229088Smarkm _flags, 4329088Smarkm _message_type, 4429088Smarkm _message_size); 4529088Smarkm } 4631622Scharnier 4729088Smarkm /** 4829088Smarkm * The byteBuffer is presumed to have contents of the message already 4929088Smarkm * read in. It must have 12 bytes of space at the beginning for the GIOP header, 5029088Smarkm * but the header doesn't have to be copied in. 5129088Smarkm */ 5229088Smarkm public void unmarshalRequestID(ByteBuffer byteBuffer) { 5329088Smarkm int b1, b2, b3, b4; 5429088Smarkm 5529088Smarkm if (!isLittleEndian()) { 5629088Smarkm b1 = (byteBuffer.get(GIOPMessageHeaderLength+0) << 24) & 0xFF000000; 5729088Smarkm b2 = (byteBuffer.get(GIOPMessageHeaderLength+1) << 16) & 0x00FF0000; 5829088Smarkm b3 = (byteBuffer.get(GIOPMessageHeaderLength+2) << 8) & 0x0000FF00; 5987139Smarkm b4 = (byteBuffer.get(GIOPMessageHeaderLength+3) << 0) & 0x000000FF; 6087139Smarkm } else { 6129088Smarkm b1 = (byteBuffer.get(GIOPMessageHeaderLength+3) << 24) & 0xFF000000; 6287139Smarkm b2 = (byteBuffer.get(GIOPMessageHeaderLength+2) << 16) & 0x00FF0000; 6329088Smarkm b3 = (byteBuffer.get(GIOPMessageHeaderLength+1) << 8) & 0x0000FF00; 6429088Smarkm b4 = (byteBuffer.get(GIOPMessageHeaderLength+0) << 0) & 0x000000FF; 6529088Smarkm } 6629088Smarkm 6729088Smarkm this.request_id = (b1 | b2 | b3 | b4); 6829088Smarkm } 6929088Smarkm 7029088Smarkm public void write(org.omg.CORBA.portable.OutputStream ostream) { 7129088Smarkm if (this.encodingVersion == Message.CDR_ENC_VERSION) { 7229088Smarkm super.write(ostream); 7329088Smarkm return; 7429088Smarkm } 7529088Smarkm GIOPVersion gv = this.GIOP_version; // save 7629088Smarkm this.GIOP_version = GIOPVersion.getInstance((byte)13, 7729088Smarkm this.encodingVersion); 7829088Smarkm super.write(ostream); 7929088Smarkm this.GIOP_version = gv; // restore 8029088Smarkm } 8129088Smarkm} 8229088Smarkm