1 7 package com.sun.corba.se.impl.encoding; 8 9 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 10 import com.sun.corba.se.impl.orbutil.ORBConstants; 11 12 public class CDRInputStream_1_2 extends CDRInputStream_1_1 13 { 14 protected boolean headerPadding; 19 20 protected boolean restoreHeaderPadding; 22 23 void setHeaderPadding(boolean headerPadding) { 25 this.headerPadding = headerPadding; 26 } 27 28 31 public void mark(int readlimit) { 32 super.mark(readlimit); 33 restoreHeaderPadding = headerPadding; 34 } 35 36 public void reset() { 37 super.reset(); 38 headerPadding = restoreHeaderPadding; 39 restoreHeaderPadding = false; 40 } 41 42 public CDRInputStreamBase dup() { 46 CDRInputStreamBase result = super.dup(); 47 ((CDRInputStream_1_2)result).headerPadding = this.headerPadding; 48 return result; 49 } 50 51 protected void alignAndCheck(int align, int n) { 52 53 if (headerPadding == true) { 61 headerPadding = false; 62 alignOnBoundary(ORBConstants.GIOP_12_MSG_BODY_ALIGNMENT); 63 } 64 65 checkBlockLength(align, n); 66 67 70 76 int alignIncr = computeAlignment(bbwi.position(),align); 77 bbwi.position(bbwi.position() + alignIncr); 78 79 if (bbwi.position() + n > bbwi.buflen) { 80 grow(1, n); 81 } 82 } 83 84 public GIOPVersion getGIOPVersion() { 85 return GIOPVersion.V1_2; 86 } 87 88 public char read_wchar() { 89 int numBytes = read_octet(); 92 93 char[] result = getConvertedChars(numBytes, getWCharConverter()); 94 95 if (getWCharConverter().getNumChars() > 1) 100 throw wrapper.btcResultMoreThanOneChar() ; 101 102 return result[0]; 103 } 104 105 public String read_wstring() { 106 111 int len = read_long(); 112 113 if (len == 0) 118 return new String (""); 119 120 checkForNegativeLength(len); 121 122 return new String (getConvertedChars(len, getWCharConverter()), 123 0, 124 getWCharConverter().getNumChars()); 125 } 126 } 127 | Popular Tags |