KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > protocol > giopmsgheaders > FragmentMessage_1_2


1 /*
2  * @(#)FragmentMessage_1_2.java 1.12 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.protocol.giopmsgheaders;
9
10 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
11
12 /**
13  * This implements the GIOP 1.2 Fragment header.
14  *
15  * @author Ram Jeyaraman 05/14/2000
16  * @version 1.0
17  */

18
19 public final class FragmentMessage_1_2 extends Message_1_2
20         implements FragmentMessage {
21
22     // Constructors
23

24     FragmentMessage_1_2() {}
25
26     // This is currently never called.
27
FragmentMessage_1_2(int _request_id) {
28         super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
29             Message.GIOPFragment, 0);
30         this.message_type = GIOPFragment;
31         request_id = _request_id;
32     }
33
34     FragmentMessage_1_2(Message_1_1 msg12) {
35         this.magic = msg12.magic;
36         this.GIOP_version = msg12.GIOP_version;
37         this.flags = msg12.flags;
38         this.message_type = GIOPFragment;
39         this.message_size = 0;
40
41         switch (msg12.message_type) {
42         case GIOPRequest :
43             this.request_id = ((RequestMessage) msg12).getRequestId();
44             break;
45         case GIOPReply :
46             this.request_id = ((ReplyMessage) msg12).getRequestId();
47             break;
48         case GIOPLocateRequest :
49             this.request_id = ((LocateRequestMessage) msg12).getRequestId();
50             break;
51         case GIOPLocateReply :
52             this.request_id = ((LocateReplyMessage) msg12).getRequestId();
53             break;
54         case GIOPFragment :
55             this.request_id = ((FragmentMessage) msg12).getRequestId();
56             break;
57         }
58     }
59
60     // Accessor methods
61

62     public int getRequestId() {
63         return this.request_id;
64     }
65
66     public int getHeaderLength() {
67         return GIOPMessageHeaderLength + 4;
68     }
69     
70     // IO methods
71

72     /* This will never be called, since we do not currently read the
73      * request_id from an CDRInputStream. Instead we use the
74      * readGIOP_1_2_requestId to read the requestId from a byte buffer.
75      */

76     public void read(org.omg.CORBA.portable.InputStream JavaDoc istream) {
77         super.read(istream);
78         this.request_id = istream.read_ulong();
79     }
80
81     public void write(org.omg.CORBA.portable.OutputStream JavaDoc ostream) {
82         super.write(ostream);
83         ostream.write_ulong(this.request_id);
84     }
85
86     public void callback(MessageHandler handler)
87         throws java.io.IOException JavaDoc
88     {
89         handler.handleInput(this);
90     }
91 } // class FragmentMessage_1_2
92
Popular Tags