KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)Message.java 1.11 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 java.io.IOException JavaDoc;
11 import java.nio.ByteBuffer JavaDoc;
12 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
13
14 /**
15  * This is the base interface for different message type interfaces.
16  *
17  * @author Ram Jeyaraman 05/14/2000
18  * @version 1.0
19  */

20
21 public interface Message {
22
23     // Generic constants
24

25     int defaultBufferSize = 1024;
26     int GIOPBigEndian = 0;
27     int GIOPLittleEndian = 1;
28     int GIOPBigMagic = 0x47494F50;
29     int GIOPLittleMagic = 0x504F4947;
30     int GIOPMessageHeaderLength = 12;
31
32     // Other useful constants
33

34     byte LITTLE_ENDIAN_BIT = 0x01;
35     byte MORE_FRAGMENTS_BIT = 0x02;
36     byte FLAG_NO_FRAG_BIG_ENDIAN = 0x00;
37     static final byte TRAILING_TWO_BIT_BYTE_MASK = 0x3;
38     static final byte THREAD_POOL_TO_USE_MASK = 0x3F;
39
40     // Encoding related constants
41

42     byte CDR_ENC_VERSION = 0x00;
43     byte JAVA_ENC_VERSION = 0x01;
44
45     // Message types
46

47     byte GIOPRequest = 0;
48     byte GIOPReply = 1;
49     byte GIOPCancelRequest = 2;
50     byte GIOPLocateRequest = 3;
51     byte GIOPLocateReply = 4;
52     byte GIOPCloseConnection = 5;
53     byte GIOPMessageError = 6;
54     byte GIOPFragment = 7; // 1.1 & 1.2:
55

56     // Accessor methods
57

58     GIOPVersion getGIOPVersion();
59     byte getEncodingVersion();
60     boolean isLittleEndian();
61     boolean moreFragmentsToFollow();
62     int getType();
63     int getSize();
64     ByteBuffer JavaDoc getByteBuffer();
65     int getThreadPoolToUse();
66
67     // Mutator methods
68

69     void read(org.omg.CORBA.portable.InputStream JavaDoc istream);
70     void write(org.omg.CORBA.portable.OutputStream JavaDoc ostream);
71
72     void setSize(ByteBuffer JavaDoc byteBuffer, int size);
73
74     FragmentMessage createFragmentMessage();
75
76     void callback(MessageHandler handler) throws IOException JavaDoc;
77
78     void setByteBuffer(ByteBuffer JavaDoc byteBuffer);
79     void setEncodingVersion(byte version);
80 }
81
Popular Tags