1 7 8 package com.sun.corba.se.impl.encoding; 9 10 import java.nio.ByteBuffer ; 11 import org.omg.CORBA.CompletionStatus ; 12 import com.sun.org.omg.SendingContext.CodeBase; 13 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 14 import com.sun.corba.se.impl.encoding.CDRInputStream; 15 import com.sun.corba.se.impl.encoding.BufferManagerFactory; 16 import com.sun.corba.se.impl.encoding.CodeSetConversion; 17 import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; 18 import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; 19 20 import com.sun.corba.se.spi.orb.ORB; 21 22 import com.sun.corba.se.spi.logging.CORBALogDomains; 23 24 import com.sun.corba.se.impl.logging.ORBUtilSystemException; 25 26 39 public class EncapsInputStream extends CDRInputStream 40 { 41 private ORBUtilSystemException wrapper ; 42 43 public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] buf, 47 int size, boolean littleEndian, 48 GIOPVersion version) { 49 super(orb, ByteBuffer.wrap(buf), size, littleEndian, 50 version, Message.CDR_ENC_VERSION, 51 BufferManagerFactory.newBufferManagerRead( 52 BufferManagerFactory.GROW, 53 Message.CDR_ENC_VERSION, 54 (ORB)orb)); 55 56 wrapper = ORBUtilSystemException.get( (ORB)orb, 57 CORBALogDomains.RPC_ENCODING ) ; 58 59 performORBVersionSpecificInit(); 60 } 61 62 public EncapsInputStream(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer, 63 int size, boolean littleEndian, 64 GIOPVersion version) { 65 super(orb, byteBuffer, size, littleEndian, 66 version, Message.CDR_ENC_VERSION, 67 BufferManagerFactory.newBufferManagerRead( 68 BufferManagerFactory.GROW, 69 Message.CDR_ENC_VERSION, 70 (com.sun.corba.se.spi.orb.ORB)orb)); 71 72 performORBVersionSpecificInit(); 73 } 74 75 public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size) 80 { 81 this(orb, data, size, GIOPVersion.V1_2); 82 } 83 84 public EncapsInputStream(EncapsInputStream eis) 86 { 87 super(eis); 88 89 wrapper = ORBUtilSystemException.get( (ORB)(eis.orb()), 90 CORBALogDomains.RPC_ENCODING ) ; 91 92 performORBVersionSpecificInit(); 93 } 94 95 public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size, GIOPVersion version) 102 { 103 this(orb, data, size, false, version); 104 } 105 106 112 public EncapsInputStream(org.omg.CORBA.ORB orb, 113 byte[] data, 114 int size, 115 GIOPVersion version, 116 CodeBase codeBase) { 117 super(orb, 118 ByteBuffer.wrap(data), 119 size, 120 false, 121 version, Message.CDR_ENC_VERSION, 122 BufferManagerFactory.newBufferManagerRead( 123 BufferManagerFactory.GROW, 124 Message.CDR_ENC_VERSION, 125 (ORB)orb)); 126 127 this.codeBase = codeBase; 128 129 performORBVersionSpecificInit(); 130 } 131 132 public CDRInputStream dup() { 133 return new EncapsInputStream(this); 134 } 135 136 protected CodeSetConversion.BTCConverter createCharBTCConverter() { 137 return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1); 138 } 139 140 protected CodeSetConversion.BTCConverter createWCharBTCConverter() { 141 if (getGIOPVersion().equals(GIOPVersion.V1_0)) 143 throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE); 144 145 if (getGIOPVersion().equals(GIOPVersion.V1_1)) 148 return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.UTF_16, 149 isLittleEndian()); 150 151 return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.UTF_16, 159 false); 160 } 161 162 public CodeBase getCodeBase() { 163 return codeBase; 164 } 165 166 private CodeBase codeBase; 167 } 168 | Popular Tags |