FileDocCategorySizeDatePackage
Message_1_1.javaAPI DocJava SE 5 API5552Fri Aug 26 14:54:32 BST 2005com.sun.corba.se.impl.protocol.giopmsgheaders

Message_1_1

public class Message_1_1 extends MessageBase

Fields Summary
static final int
UPPER_THREE_BYTES_OF_INT_MASK
private static ORBUtilSystemException
wrapper
int
magic
GIOPVersion
GIOP_version
byte
flags
byte
message_type
int
message_size
Constructors Summary
Message_1_1()


    // Constructor

     
    
Message_1_1(int _magic, GIOPVersion _GIOP_version, byte _flags, byte _message_type, int _message_size)

        magic = _magic;
        GIOP_version = _GIOP_version;
        flags = _flags;
        message_type = _message_type;
        message_size = _message_size;
    
Methods Summary
public com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessagecreateFragmentMessage()
Allows us to create a fragment message from any message type.


        // check for message type validity

        switch (this.message_type) {
        case GIOPCancelRequest :
        case GIOPCloseConnection :
        case GIOPMessageError :
	    throw wrapper.fragmentationDisallowed(
		CompletionStatus.COMPLETED_MAYBE);
        case GIOPLocateRequest :
        case GIOPLocateReply :
            if (this.GIOP_version.equals(GIOPVersion.V1_1)) {
		throw wrapper.fragmentationDisallowed(
		    CompletionStatus.COMPLETED_MAYBE);
            }
            break;
        }

        /*
        // A fragmented mesg can be created only if the current mesg' fragment
        // bit is set. Otherwise, raise error
        // too stringent check
        if ( (this.flags & MORE_FRAGMENTS_BIT) != MORE_FRAGMENTS_BIT ) {
		throw wrapper.fragmentationDisallowed( CompletionStatus.COMPLETED_MAYBE);
        }
        */
        if (this.GIOP_version.equals(GIOPVersion.V1_1)) {
            return new FragmentMessage_1_1(this);
        } else if (this.GIOP_version.equals(GIOPVersion.V1_2)) {
            return new FragmentMessage_1_2(this);
        }

	throw wrapper.giopVersionError( CompletionStatus.COMPLETED_MAYBE);
    
public com.sun.corba.se.spi.ior.iiop.GIOPVersiongetGIOPVersion()

        return this.GIOP_version;
    
public intgetSize()

	    return this.message_size;
    
public intgetType()

    	return this.message_type;
    
public booleanisLittleEndian()

    	return ((this.flags & LITTLE_ENDIAN_BIT) == LITTLE_ENDIAN_BIT);
    
public booleanmoreFragmentsToFollow()

        return ( (this.flags & MORE_FRAGMENTS_BIT) == MORE_FRAGMENTS_BIT );
    
public voidread(org.omg.CORBA.portable.InputStream istream)

        /*
        this.magic = istream.read_long();
        this.GIOP_version = (new GIOPVersion()).read(istream);
        this.flags = istream.read_octet();
        this.message_type = istream.read_octet();
        this.message_size = istream.read_ulong();
        */
    
public voidsetSize(java.nio.ByteBuffer byteBuffer, int size)


	this.message_size = size;

        //
    	// Patch the size field in the header.
	//

	int patch = size - GIOPMessageHeaderLength;
        if (!isLittleEndian()) {
            byteBuffer.put(8,  (byte)((patch >>> 24) & 0xFF));
            byteBuffer.put(9,  (byte)((patch >>> 16) & 0xFF));
            byteBuffer.put(10, (byte)((patch >>> 8)  & 0xFF));
            byteBuffer.put(11, (byte)((patch >>> 0)  & 0xFF));
        } else {
            byteBuffer.put(8,  (byte)((patch >>> 0)  & 0xFF));
            byteBuffer.put(9,  (byte)((patch >>> 8)  & 0xFF));
            byteBuffer.put(10, (byte)((patch >>> 16) & 0xFF));
            byteBuffer.put(11, (byte)((patch >>> 24) & 0xFF));
        }
    
public voidsetThreadPoolToUse(int poolToUse)

	// IMPORTANT: Bitwise operations will promote
	//            byte types to int before performing
	//            bitwise operations. And, Java
	//            types are signed.
	int tmpFlags = poolToUse << 2;
	tmpFlags &= UPPER_THREE_BYTES_OF_INT_MASK;
	tmpFlags |= flags;
	flags = (byte)tmpFlags;
    
public voidwrite(org.omg.CORBA.portable.OutputStream ostream)

        ostream.write_long(this.magic);
        nullCheck(this.GIOP_version);
        this.GIOP_version.write(ostream);
        ostream.write_octet(this.flags);
        ostream.write_octet(this.message_type);
        ostream.write_ulong(this.message_size);