1 7 package com.sun.corba.se.impl.encoding; 8 9 import java.io.IOException ; 10 import java.io.Serializable ; 11 import java.math.BigDecimal ; 12 import java.nio.ByteBuffer ; 13 14 import org.omg.CORBA.TypeCode ; 15 import org.omg.CORBA.Principal ; 16 import org.omg.CORBA.Any ; 17 18 import com.sun.org.omg.SendingContext.CodeBase; 19 20 import com.sun.corba.se.pept.protocol.MessageMediator; 21 22 import com.sun.corba.se.spi.logging.CORBALogDomains; 23 import com.sun.corba.se.spi.orb.ORB; 24 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 25 import com.sun.corba.se.spi.protocol.CorbaMessageMediator; 26 27 import com.sun.corba.se.impl.logging.ORBUtilSystemException; 28 import com.sun.corba.se.impl.encoding.CodeSetConversion; 29 import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; 30 import com.sun.corba.se.impl.orbutil.ORBUtility; 31 import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; 32 33 41 public abstract class CDRInputStream 42 extends org.omg.CORBA_2_3.portable.InputStream 43 implements com.sun.corba.se.impl.encoding.MarshalInputStream, 44 org.omg.CORBA.DataInputStream , org.omg.CORBA.portable.ValueInputStream 45 { 46 protected CorbaMessageMediator messageMediator; 47 private CDRInputStreamBase impl; 48 49 private static class InputStreamFactory { 52 53 public static CDRInputStreamBase newInputStream( 54 ORB orb, GIOPVersion version, byte encodingVersion) { 55 switch(version.intValue()) { 56 case GIOPVersion.VERSION_1_0: 57 return new CDRInputStream_1_0(); 58 case GIOPVersion.VERSION_1_1: 59 return new CDRInputStream_1_1(); 60 case GIOPVersion.VERSION_1_2: 61 if (encodingVersion != Message.CDR_ENC_VERSION) { 62 return 63 new IDLJavaSerializationInputStream(encodingVersion); 64 } 65 return new CDRInputStream_1_2(); 66 default: 68 ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb, 69 CORBALogDomains.RPC_ENCODING ) ; 70 throw wrapper.unsupportedGiopVersion( version ) ; 71 } 72 } 73 } 74 75 public CDRInputStream() { 84 } 85 86 public CDRInputStream(CDRInputStream is) { 87 impl = is.impl.dup(); 88 impl.setParent(this); 89 } 90 91 public CDRInputStream(org.omg.CORBA.ORB orb, 92 ByteBuffer byteBuffer, 93 int size, 94 boolean littleEndian, 95 GIOPVersion version, 96 byte encodingVersion, 97 BufferManagerRead bufMgr) 98 { 99 impl = InputStreamFactory.newInputStream((ORB)orb, version, 100 encodingVersion); 101 102 impl.init(orb, byteBuffer, size, littleEndian, bufMgr); 103 104 impl.setParent(this); 105 } 106 107 public final boolean read_boolean() { 109 return impl.read_boolean(); 110 } 111 112 public final char read_char() { 113 return impl.read_char(); 114 } 115 116 public final char read_wchar() { 117 return impl.read_wchar(); 118 } 119 120 public final byte read_octet() { 121 return impl.read_octet(); 122 } 123 124 public final short read_short() { 125 return impl.read_short(); 126 } 127 128 public final short read_ushort() { 129 return impl.read_ushort(); 130 } 131 132 public final int read_long() { 133 return impl.read_long(); 134 } 135 136 public final int read_ulong() { 137 return impl.read_ulong(); 138 } 139 140 public final long read_longlong() { 141 return impl.read_longlong(); 142 } 143 144 public final long read_ulonglong() { 145 return impl.read_ulonglong(); 146 } 147 148 public final float read_float() { 149 return impl.read_float(); 150 } 151 152 public final double read_double() { 153 return impl.read_double(); 154 } 155 156 public final String read_string() { 157 return impl.read_string(); 158 } 159 160 public final String read_wstring() { 161 return impl.read_wstring(); 162 } 163 164 public final void read_boolean_array(boolean[] value, int offset, int length) { 165 impl.read_boolean_array(value, offset, length); 166 } 167 168 public final void read_char_array(char[] value, int offset, int length) { 169 impl.read_char_array(value, offset, length); 170 } 171 172 public final void read_wchar_array(char[] value, int offset, int length) { 173 impl.read_wchar_array(value, offset, length); 174 } 175 176 public final void read_octet_array(byte[] value, int offset, int length) { 177 impl.read_octet_array(value, offset, length); 178 } 179 180 public final void read_short_array(short[] value, int offset, int length) { 181 impl.read_short_array(value, offset, length); 182 } 183 184 public final void read_ushort_array(short[] value, int offset, int length) { 185 impl.read_ushort_array(value, offset, length); 186 } 187 188 public final void read_long_array(int[] value, int offset, int length) { 189 impl.read_long_array(value, offset, length); 190 } 191 192 public final void read_ulong_array(int[] value, int offset, int length) { 193 impl.read_ulong_array(value, offset, length); 194 } 195 196 public final void read_longlong_array(long[] value, int offset, int length) { 197 impl.read_longlong_array(value, offset, length); 198 } 199 200 public final void read_ulonglong_array(long[] value, int offset, int length) { 201 impl.read_ulonglong_array(value, offset, length); 202 } 203 204 public final void read_float_array(float[] value, int offset, int length) { 205 impl.read_float_array(value, offset, length); 206 } 207 208 public final void read_double_array(double[] value, int offset, int length) { 209 impl.read_double_array(value, offset, length); 210 } 211 212 public final org.omg.CORBA.Object read_Object() { 213 return impl.read_Object(); 214 } 215 216 public final TypeCode read_TypeCode() { 217 return impl.read_TypeCode(); 218 } 219 public final Any read_any() { 220 return impl.read_any(); 221 } 222 223 public final Principal read_Principal() { 224 return impl.read_Principal(); 225 } 226 227 public final int read() throws java.io.IOException { 228 return impl.read(); 229 } 230 231 public final java.math.BigDecimal read_fixed() { 232 return impl.read_fixed(); 233 } 234 235 public final org.omg.CORBA.Context read_Context() { 236 return impl.read_Context(); 237 } 238 239 public final org.omg.CORBA.Object read_Object(java.lang.Class clz) { 240 return impl.read_Object(clz); 241 } 242 243 public final org.omg.CORBA.ORB orb() { 244 return impl.orb(); 245 } 246 247 public final java.io.Serializable read_value() { 249 return impl.read_value(); 250 } 251 252 public final java.io.Serializable read_value(java.lang.Class clz) { 253 return impl.read_value(clz); 254 } 255 256 public final java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) { 257 return impl.read_value(factory); 258 } 259 260 public final java.io.Serializable read_value(java.lang.String rep_id) { 261 return impl.read_value(rep_id); 262 } 263 264 public final java.io.Serializable read_value(java.io.Serializable value) { 265 return impl.read_value(value); 266 } 267 268 public final java.lang.Object read_abstract_interface() { 269 return impl.read_abstract_interface(); 270 } 271 272 public final java.lang.Object read_abstract_interface(java.lang.Class clz) { 273 return impl.read_abstract_interface(clz); 274 } 275 277 public final void consumeEndian() { 278 impl.consumeEndian(); 279 } 280 281 public final int getPosition() { 282 return impl.getPosition(); 283 } 284 285 287 public final java.lang.Object read_Abstract () { 288 return impl.read_Abstract(); 289 } 290 291 public final java.io.Serializable read_Value () { 292 return impl.read_Value(); 293 } 294 295 public final void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) { 296 impl.read_any_array(seq, offset, length); 297 } 298 299 public final void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) { 300 impl.read_boolean_array(seq, offset, length); 301 } 302 303 public final void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) { 304 impl.read_char_array(seq, offset, length); 305 } 306 307 public final void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) { 308 impl.read_wchar_array(seq, offset, length); 309 } 310 311 public final void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) { 312 impl.read_octet_array(seq, offset, length); 313 } 314 315 public final void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) { 316 impl.read_short_array(seq, offset, length); 317 } 318 319 public final void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) { 320 impl.read_ushort_array(seq, offset, length); 321 } 322 323 public final void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) { 324 impl.read_long_array(seq, offset, length); 325 } 326 327 public final void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) { 328 impl.read_ulong_array(seq, offset, length); 329 } 330 331 public final void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) { 332 impl.read_ulonglong_array(seq, offset, length); 333 } 334 335 public final void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) { 336 impl.read_longlong_array(seq, offset, length); 337 } 338 339 public final void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) { 340 impl.read_float_array(seq, offset, length); 341 } 342 343 public final void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) { 344 impl.read_double_array(seq, offset, length); 345 } 346 347 public final String [] _truncatable_ids() { 349 return impl._truncatable_ids(); 350 } 351 352 public final int read(byte b[]) throws IOException { 354 return impl.read(b); 355 } 356 357 public final int read(byte b[], int off, int len) throws IOException { 358 return impl.read(b, off, len); 359 } 360 361 public final long skip(long n) throws IOException { 362 return impl.skip(n); 363 } 364 365 public final int available() throws IOException { 366 return impl.available(); 367 } 368 369 public final void close() throws IOException { 370 impl.close(); 371 } 372 373 public final void mark(int readlimit) { 374 impl.mark(readlimit); 375 } 376 377 public final void reset() { 378 impl.reset(); 379 } 380 381 public final boolean markSupported() { 382 return impl.markSupported(); 383 } 384 385 public abstract CDRInputStream dup(); 386 387 public final java.math.BigDecimal read_fixed(short digits, short scale) { 389 return impl.read_fixed(digits, scale); 390 } 391 392 public final boolean isLittleEndian() { 393 return impl.isLittleEndian(); 394 } 395 396 protected final ByteBuffer getByteBuffer() { 397 return impl.getByteBuffer(); 398 } 399 400 protected final void setByteBuffer(ByteBuffer byteBuffer) { 401 impl.setByteBuffer(byteBuffer); 402 } 403 404 protected final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) { 405 impl.setByteBufferWithInfo(bbwi); 406 } 407 408 public final int getBufferLength() { 409 return impl.getBufferLength(); 410 } 411 412 protected final void setBufferLength(int value) { 413 impl.setBufferLength(value); 414 } 415 416 protected final int getIndex() { 417 return impl.getIndex(); 418 } 419 420 protected final void setIndex(int value) { 421 impl.setIndex(value); 422 } 423 424 public final void orb(org.omg.CORBA.ORB orb) { 425 impl.orb(orb); 426 } 427 428 public final GIOPVersion getGIOPVersion() { 429 return impl.getGIOPVersion(); 430 } 431 432 public final BufferManagerRead getBufferManager() { 433 return impl.getBufferManager(); 434 } 435 436 public CodeBase getCodeBase() { 440 return null; 441 } 442 443 protected CodeSetConversion.BTCConverter createCharBTCConverter() { 446 return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1, 447 impl.isLittleEndian()); 448 } 449 450 protected abstract CodeSetConversion.BTCConverter createWCharBTCConverter(); 453 454 void printBuffer() { 456 impl.printBuffer(); 457 } 458 459 465 public void alignOnBoundary(int octetBoundary) { 466 impl.alignOnBoundary(octetBoundary); 467 } 468 469 public void setHeaderPadding(boolean headerPadding) { 471 impl.setHeaderPadding(headerPadding); 472 } 473 474 483 public void performORBVersionSpecificInit() { 484 if (impl != null) 487 impl.performORBVersionSpecificInit(); 488 } 489 490 496 public void resetCodeSetConverters() { 497 impl.resetCodeSetConverters(); 498 } 499 500 public void setMessageMediator(MessageMediator messageMediator) 501 { 502 this.messageMediator = (CorbaMessageMediator) messageMediator; 503 } 504 505 public MessageMediator getMessageMediator() 506 { 507 return messageMediator; 508 } 509 510 512 public void start_value() { 513 impl.start_value(); 514 } 515 516 public void end_value() { 517 impl.end_value(); 518 } 519 } 520 | Popular Tags |