1 7 8 package com.sun.corba.se.impl.protocol.giopmsgheaders; 9 10 import java.nio.ByteBuffer ; 11 import org.omg.CORBA.INTERNAL ; 12 import org.omg.CORBA.CompletionStatus ; 13 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 14 15 import com.sun.corba.se.spi.logging.CORBALogDomains ; 16 import com.sun.corba.se.impl.logging.ORBUtilSystemException ; 17 18 24 25 public class Message_1_0 26 extends com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase { 27 28 private static ORBUtilSystemException wrapper = 29 ORBUtilSystemException.get( CORBALogDomains.RPC_PROTOCOL ) ; 30 31 int magic = (int) 0; 33 GIOPVersion GIOP_version = null; 34 boolean byte_order = false; 35 byte message_type = (byte) 0; 36 int message_size = (int) 0; 37 38 40 Message_1_0() { 41 } 42 43 Message_1_0(int _magic, boolean _byte_order, byte _message_type, 44 int _message_size) { 45 magic = _magic; 46 GIOP_version = GIOPVersion.V1_0; 47 byte_order = _byte_order; 48 message_type = _message_type; 49 message_size = _message_size; 50 } 51 52 54 public GIOPVersion getGIOPVersion() { 55 return this.GIOP_version; 56 } 57 58 public int getType() { 59 return this.message_type; 60 } 61 62 public int getSize() { 63 return this.message_size; 64 } 65 66 public boolean isLittleEndian() { 67 return this.byte_order; 68 } 69 70 public boolean moreFragmentsToFollow() { 71 return false; 72 } 73 74 76 public void setSize(ByteBuffer byteBuffer, int size) { 77 this.message_size = size; 78 79 int patch = size - GIOPMessageHeaderLength; 83 if (!isLittleEndian()) { 84 byteBuffer.put(8, (byte)((patch >>> 24) & 0xFF)); 85 byteBuffer.put(9, (byte)((patch >>> 16) & 0xFF)); 86 byteBuffer.put(10, (byte)((patch >>> 8) & 0xFF)); 87 byteBuffer.put(11, (byte)((patch >>> 0) & 0xFF)); 88 } else { 89 byteBuffer.put(8, (byte)((patch >>> 0) & 0xFF)); 90 byteBuffer.put(9, (byte)((patch >>> 8) & 0xFF)); 91 byteBuffer.put(10, (byte)((patch >>> 16) & 0xFF)); 92 byteBuffer.put(11, (byte)((patch >>> 24) & 0xFF)); 93 } 94 } 95 96 public FragmentMessage createFragmentMessage() { 97 throw wrapper.fragmentationDisallowed( 98 CompletionStatus.COMPLETED_MAYBE); 99 } 100 101 103 public void read(org.omg.CORBA.portable.InputStream istream) { 108 115 } 116 117 public void write(org.omg.CORBA.portable.OutputStream ostream) { 118 ostream.write_long(this.magic); 119 nullCheck(this.GIOP_version); 120 this.GIOP_version.write(ostream); 121 ostream.write_boolean(this.byte_order); 122 ostream.write_octet(this.message_type); 123 ostream.write_ulong(this.message_size); 124 } 125 126 } | Popular Tags |