1 package org.jacorb.orb.giop; 2 3 22 23 import java.io.IOException ; 24 import org.jacorb.orb.CDROutputStream; 25 26 35 36 public class MessageOutputStream 37 extends CDROutputStream 38 { 39 public MessageOutputStream() 40 { 41 super( (org.omg.CORBA.ORB ) null ); 42 } 43 44 48 49 public void writeGIOPMsgHeader( int message_type, 50 int minor_version ) 51 { 52 buffer[0] = (byte) 'G'; 54 buffer[1] = (byte) 'I'; 55 buffer[2] = (byte) 'O'; 56 buffer[3] = (byte) 'P'; 57 58 buffer[4] = 1; buffer[5] = (byte) minor_version; 62 buffer[6] = 0; 67 68 buffer[7] = (byte) message_type; 69 70 skip( Messages.MSG_HEADER_SIZE ); 72 } 73 74 public void insertMsgSize( int size ) 75 { 76 buffer[8] = (byte)((size >> 24) & 0xFF); 78 buffer[9] = (byte)((size >> 16) & 0xFF); 79 buffer[10] = (byte)((size >> 8) & 0xFF); 80 buffer[11] = (byte) (size & 0xFF); 81 } 82 83 84 public void insertMsgSize() 85 { 86 insertMsgSize( size() - Messages.MSG_HEADER_SIZE ); 87 } 88 89 public void write_to( GIOPConnection conn ) 90 throws IOException 91 { 92 insertMsgSize(); 93 94 write( conn, 0, size() ); 95 96 close(); 97 } 98 } | Popular Tags |