Thu, 31 Aug 2017 18:10:36 +0800
merge
1 /*
2 * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package com.sun.corba.se.impl.protocol.giopmsgheaders;
28 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
30 /**
31 * This implements the GIOP 1.2 Fragment header.
32 *
33 * @author Ram Jeyaraman 05/14/2000
34 */
36 public final class FragmentMessage_1_2 extends Message_1_2
37 implements FragmentMessage {
39 // Constructors
41 FragmentMessage_1_2() {}
43 // This is currently never called.
44 FragmentMessage_1_2(int _request_id) {
45 super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
46 Message.GIOPFragment, 0);
47 this.message_type = GIOPFragment;
48 request_id = _request_id;
49 }
51 FragmentMessage_1_2(Message_1_1 msg12) {
52 this.magic = msg12.magic;
53 this.GIOP_version = msg12.GIOP_version;
54 this.flags = msg12.flags;
55 this.message_type = GIOPFragment;
56 this.message_size = 0;
58 switch (msg12.message_type) {
59 case GIOPRequest :
60 this.request_id = ((RequestMessage) msg12).getRequestId();
61 break;
62 case GIOPReply :
63 this.request_id = ((ReplyMessage) msg12).getRequestId();
64 break;
65 case GIOPLocateRequest :
66 this.request_id = ((LocateRequestMessage) msg12).getRequestId();
67 break;
68 case GIOPLocateReply :
69 this.request_id = ((LocateReplyMessage) msg12).getRequestId();
70 break;
71 case GIOPFragment :
72 this.request_id = ((FragmentMessage) msg12).getRequestId();
73 break;
74 }
75 }
77 // Accessor methods
79 public int getRequestId() {
80 return this.request_id;
81 }
83 public int getHeaderLength() {
84 return GIOPMessageHeaderLength + 4;
85 }
87 // IO methods
89 /* This will never be called, since we do not currently read the
90 * request_id from an CDRInputStream. Instead we use the
91 * readGIOP_1_2_requestId to read the requestId from a byte buffer.
92 */
93 public void read(org.omg.CORBA.portable.InputStream istream) {
94 super.read(istream);
95 this.request_id = istream.read_ulong();
96 }
98 public void write(org.omg.CORBA.portable.OutputStream ostream) {
99 super.write(ostream);
100 ostream.write_ulong(this.request_id);
101 }
103 public void callback(MessageHandler handler)
104 throws java.io.IOException
105 {
106 handler.handleInput(this);
107 }
108 } // class FragmentMessage_1_2