1 29 30 package com.caucho.iiop; 31 32 import java.io.IOException ; 33 34 public class Iiop12Writer extends Iiop10Writer { 35 private final static int KEY_ADDR = 0; 36 private final static int PROFILE_ADDR = 1; 37 private final static int REFERENCE_ADDR = 2; 38 43 public void startRequest(byte []oid, int off, int len, 44 String operation, int requestId) 45 throws IOException 46 { 47 _out.start12Message(IiopReader.MSG_REQUEST, requestId); 48 49 int flags = 0; 50 51 _out.write(1); _out.write(0); 53 _out.write(0); 54 _out.write(0); 55 56 write_short((short) KEY_ADDR); writeBytes(oid, off, len); 59 writeString(operation); 60 61 write_long(0); } 63 66 public void startReplyOk(int requestId) 67 throws IOException 68 { 69 _out.start12Message(IiopReader.MSG_REPLY, requestId); 70 71 write_long(IiopReader.STATUS_NO_EXCEPTION); write_long(0); } 74 75 78 public void startReplySystemException(int requestId, 79 String exceptionId, 80 int minorStatus, 81 int completionStatus) 82 throws IOException 83 { 84 _out.start12Message(IiopReader.MSG_REPLY, requestId); 85 86 write_long(IiopReader.STATUS_SYSTEM_EXCEPTION); 87 write_long(0); 89 writeString(exceptionId); 90 write_long(minorStatus); 91 write_long(completionStatus); 92 } 93 94 97 public void startReplyUserException(int requestId) 98 throws IOException 99 { 100 _out.start12Message(IiopReader.MSG_REPLY, requestId); 101 102 write_long(IiopReader.STATUS_USER_EXCEPTION); 103 write_long(0); } 105 106 109 public void write_wchar(char v) 110 { 111 _out.write(2); 112 _out.write(v >> 8); 113 _out.write(v); 114 } 115 116 119 public void write_wstring(String a) 120 { 121 if (a == null) { 122 write_long(0); 123 return; 124 } 125 126 int length = a.length(); 127 write_long(2 * length); 128 for (int i = 0; i < length; i++) 129 _out.writeShort((int) a.charAt(i)); 130 } 131 } 132 | Popular Tags |