Module: R2CORBA::CORBA::Portable::InputStream
- Defined in:
- lib/corba/cbase/Streams.rb,
lib/corba/jbase/Streams.rb
Constant Summary collapse
- @@wrapper_klass =
Class.new do include CORBA::Portable::InputStream def initialize(jobj) @stream_ = jobj end attr_reader :stream_ end
Class Method Summary collapse
Instance Method Summary collapse
- #read_Abstract ⇒ Object
- #read_any ⇒ Object
- #read_boolean ⇒ Object
- #read_boolean_array(arr, offset, length) ⇒ Object
- #read_char ⇒ Object
- #read_char_array(arr, offset, length) ⇒ Object
- #read_construct(tc) ⇒ Object
- #read_double ⇒ Object
- #read_double_array(arr, offset, length) ⇒ Object
- #read_fixed ⇒ Object
- #read_float ⇒ Object
- #read_float_array(arr, offset, length) ⇒ Object
- #read_long ⇒ Object
- #read_long_array(arr, offset, length) ⇒ Object
- #read_longlong ⇒ Object
- #read_longlong_array(arr, offset, length) ⇒ Object
- #read_member(tc) ⇒ Object
- #read_Object ⇒ Object
- #read_octet(value) ⇒ Object
- #read_octet_array(arr, offset, length) ⇒ Object
- #read_short ⇒ Object
- #read_short_array(arr, offset, length) ⇒ Object
- #read_string ⇒ Object
- #read_TypeCode ⇒ Object
- #read_ulong ⇒ Object
- #read_ulong_array(arr, offset, length) ⇒ Object
- #read_ulonglong ⇒ Object
- #read_ulonglong_array(arr, offset, length) ⇒ Object
- #read_ushort ⇒ Object
- #read_ushort_array(arr, offset, length) ⇒ Object
- #read_value ⇒ Object (also: #read_Value)
- #read_valuebox(boxedvalue_helper) ⇒ Object
- #read_wchar ⇒ Object
- #read_wchar_array(arr, offset, length) ⇒ Object
- #read_wstring ⇒ Object
Class Method Details
Instance Method Details
#read_Abstract ⇒ Object
367 368 369 370 371 372 373 374 375 |
# File 'lib/corba/jbase/Streams.rb', line 367 def read_Abstract begin obj = self.stream_.read_abstract_interface rescue ::NativeException CORBA::Exception.native2r($!) end obj = CORBA::Object._wrap_native(obj) if obj.is_a?(CORBA::Native::Object) obj end |
#read_any ⇒ Object
89 90 91 92 93 94 95 |
# File 'lib/corba/jbase/Streams.rb', line 89 def read_any begin self.stream_.read_any rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_boolean ⇒ Object
97 98 99 100 101 102 103 |
# File 'lib/corba/jbase/Streams.rb', line 97 def read_boolean begin self.stream_.read_boolean rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_boolean_array(arr, offset, length) ⇒ Object
105 106 107 108 109 110 111 112 113 |
# File 'lib/corba/jbase/Streams.rb', line 105 def read_boolean_array(arr, offset, length) jarr = Array.new(arr.size).to_java(:boolean) begin self.stream_.read_boolean_array(jarr, offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end arr.fill(offset, length) { |i| jarr[i] } end |
#read_char ⇒ Object
115 116 117 118 119 120 121 |
# File 'lib/corba/jbase/Streams.rb', line 115 def read_char begin self.stream_.read_char.chr rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_char_array(arr, offset, length) ⇒ Object
123 124 125 126 127 128 129 130 131 |
# File 'lib/corba/jbase/Streams.rb', line 123 def read_char_array(arr, offset, length) jarr = Array.new(arr.size).to_java(:char) begin self.stream_.read_char_array(jarr, offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end arr.fill(offset, length) { |i| jarr[i].chr } end |
#read_construct(tc) ⇒ Object
357 358 359 360 361 362 363 364 365 |
# File 'lib/corba/jbase/Streams.rb', line 357 def read_construct(tc) begin jany = self.stream_.orb.create_any jany.read_value(self.stream_, tc.tc_) CORBA::Any.from_java(jany, self.stream_.orb, tc) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_double ⇒ Object
299 300 301 302 303 304 305 |
# File 'lib/corba/jbase/Streams.rb', line 299 def read_double begin self.stream_.read_double rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_double_array(arr, offset, length) ⇒ Object
307 308 309 310 311 312 313 314 315 |
# File 'lib/corba/jbase/Streams.rb', line 307 def read_double_array(arr, offset, length) jarr = Array.new(arr.size).to_java(:double) begin self.stream_.read_double_array(jarr, offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end arr.fill(offset, length) { |i| jarr[i] } end |
#read_fixed ⇒ Object
349 350 351 352 353 354 355 |
# File 'lib/corba/jbase/Streams.rb', line 349 def read_fixed begin java.math.BigDecimal.new(self.stream_.read_fixed.toString) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_float ⇒ Object
281 282 283 284 285 286 287 |
# File 'lib/corba/jbase/Streams.rb', line 281 def read_float begin self.stream_.read_float rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_float_array(arr, offset, length) ⇒ Object
289 290 291 292 293 294 295 296 297 |
# File 'lib/corba/jbase/Streams.rb', line 289 def read_float_array(arr, offset, length) jarr = Array.new(arr.size).to_java(:float) begin self.stream_.read_float_array(jarr, offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end arr.fill(offset, length) { |i| jarr[i] } end |
#read_long ⇒ Object
207 208 209 210 211 212 213 |
# File 'lib/corba/jbase/Streams.rb', line 207 def read_long begin self.stream_.read_long rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_long_array(arr, offset, length) ⇒ Object
215 216 217 218 219 220 221 222 223 |
# File 'lib/corba/jbase/Streams.rb', line 215 def read_long_array(arr, offset, length) jarr = Array.new(arr.size).to_java(:int) begin self.stream_.read_long_array(jarr, offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end arr.fill(offset, length) { |i| jarr[i] } end |
#read_longlong ⇒ Object
244 245 246 247 248 249 250 |
# File 'lib/corba/jbase/Streams.rb', line 244 def read_longlong begin self.stream_.read_longlong rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_longlong_array(arr, offset, length) ⇒ Object
252 253 254 255 256 257 258 259 260 |
# File 'lib/corba/jbase/Streams.rb', line 252 def read_longlong_array(arr, offset, length) jarr = Array.new(arr.size).to_java(:long) begin self.stream_.read_longlong_array(jarr, offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end arr.fill(offset, length) { |i| jarr[i] } end |
#read_member(tc) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/corba/cbase/Streams.rb', line 17 def read_member(tc) tc = tc.resolved_tc # takes care of recursive typecodes v = case tc.kind when TK_ANY read_any when TK_BOOLEAN read_boolean when TK_SHORT read_short when TK_LONG read_long when TK_USHORT read_ushort when TK_WCHAR read_wchar when TK_ULONG read_ulong when TK_LONGLONG read_longlong when TK_ULONGLONG read_ulonglong when TK_OCTET read_octet when TK_FLOAT read_float when TK_DOUBLE read_double when TK_LONGDOUBLE raise CORBA::NO_IMPLEMENT.new('LongDouble not supported', 0, CORBA::COMPLETED_NO) when TK_FIXED read_fixed when TK_CHAR read_char when TK_STRING read_string when TK_WSTRING read_wstring when TK_OBJREF read_Object when TK_TYPECODE read_TypeCode when TK_ARRAY, TK_SEQUENCE, TK_ENUM, TK_STRUCT, TK_EXCEPT, TK_UNION, TK_PRINCIPAL read_construct(tc) when TK_ABSTRACT_INTERFACE read_Abstract when TK_VALUE, TK_VALUE_BOX, TK_EVENT read_Value ## TODO: TK_NATIVE end v end |
#read_Object ⇒ Object
333 334 335 336 337 338 339 |
# File 'lib/corba/jbase/Streams.rb', line 333 def read_Object begin CORBA::Object._wrap_native(self.stream_.read_Object) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_octet(value) ⇒ Object
151 152 153 154 155 156 157 |
# File 'lib/corba/jbase/Streams.rb', line 151 def read_octet(value) begin [self.stream_.read_octet].pack('c').unpack('C').first rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_octet_array(arr, offset, length) ⇒ Object
159 160 161 162 163 164 165 166 167 168 |
# File 'lib/corba/jbase/Streams.rb', line 159 def read_octet_array(arr, offset, length) jarr = Array.new(arr.size).to_java(:byte) begin self.stream_.read_octet_array(jarr, offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end jarr = jarr.pack('c*').unpack('C*') arr.fill(offset, length) { |i| jarr[i] } end |
#read_short ⇒ Object
170 171 172 173 174 175 176 |
# File 'lib/corba/jbase/Streams.rb', line 170 def read_short begin self.stream_.read_short rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_short_array(arr, offset, length) ⇒ Object
178 179 180 181 182 183 184 185 186 |
# File 'lib/corba/jbase/Streams.rb', line 178 def read_short_array(arr, offset, length) jarr = Array.new(arr.size).to_java(:short) begin self.stream_.read_short_array(jarr, offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end arr.fill(offset, length) { |i| jarr[i] } end |
#read_string ⇒ Object
317 318 319 320 321 322 323 |
# File 'lib/corba/jbase/Streams.rb', line 317 def read_string begin self.stream_.read_string rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_TypeCode ⇒ Object
341 342 343 344 345 346 347 |
# File 'lib/corba/jbase/Streams.rb', line 341 def read_TypeCode begin CORBA::TypeCode._wrap_native(self.stream_.read_TypeCode) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_ulong ⇒ Object
225 226 227 228 229 230 231 |
# File 'lib/corba/jbase/Streams.rb', line 225 def read_ulong begin [self.stream_.read_ulong].pack('l').unpack('L').first rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_ulong_array(arr, offset, length) ⇒ Object
233 234 235 236 237 238 239 240 241 242 |
# File 'lib/corba/jbase/Streams.rb', line 233 def read_ulong_array(arr, offset, length) jarr = Array.new(arr.size).to_java(:int) begin self.stream_.read_ulong_array(jarr, offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end jarr = jarr.pack('l*').unpack('L*') arr.fill(offset, length) { |i| jarr[i] } end |
#read_ulonglong ⇒ Object
262 263 264 265 266 267 268 |
# File 'lib/corba/jbase/Streams.rb', line 262 def read_ulonglong begin [self.stream_.read_ulonglong].pack('q').unpack('Q').first rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_ulonglong_array(arr, offset, length) ⇒ Object
270 271 272 273 274 275 276 277 278 279 |
# File 'lib/corba/jbase/Streams.rb', line 270 def read_ulonglong_array(arr, offset, length) jarr = Array.new(arr.size).to_java(:long) begin self.stream_.read_ulonglong_array(jarr, offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end jarr = jarr.pack('q*').unpack('Q*') arr.fill(offset, length) { |i| jarr[i] } end |
#read_ushort ⇒ Object
188 189 190 191 192 193 194 |
# File 'lib/corba/jbase/Streams.rb', line 188 def read_ushort begin [self.stream_.read_ushort].pack('s').unpack('S').first rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_ushort_array(arr, offset, length) ⇒ Object
196 197 198 199 200 201 202 203 204 205 |
# File 'lib/corba/jbase/Streams.rb', line 196 def read_ushort_array(arr, offset, length) jarr = Array.new(arr.size).to_java(:short) begin self.stream_.read_octet_array(jarr, offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end jarr = jarr.pack('s*').unpack('S*') arr.fill(offset, length) { |i| jarr[i] } end |
#read_value ⇒ Object Also known as: read_Value
377 378 379 380 381 382 383 |
# File 'lib/corba/jbase/Streams.rb', line 377 def read_value begin self.stream_.read_value rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_valuebox(boxedvalue_helper) ⇒ Object
385 386 387 388 389 390 391 |
# File 'lib/corba/jbase/Streams.rb', line 385 def read_valuebox(boxedvalue_helper) begin self.stream_.read_value(boxedvalue_helper) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_wchar ⇒ Object
133 134 135 136 137 138 139 |
# File 'lib/corba/jbase/Streams.rb', line 133 def read_wchar begin self.stream_.read_wchar rescue ::NativeException CORBA::Exception.native2r($!) end end |
#read_wchar_array(arr, offset, length) ⇒ Object
141 142 143 144 145 146 147 148 149 |
# File 'lib/corba/jbase/Streams.rb', line 141 def read_wchar_array(arr, offset, length) jarr = Array.new(arr.size).to_java(:char) begin self.stream_.read_char_array(jarr, offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end arr.fill(offset, length) { |i| jarr[i] } end |
#read_wstring ⇒ Object
325 326 327 328 329 330 331 |
# File 'lib/corba/jbase/Streams.rb', line 325 def read_wstring begin self.stream_.read_wstring rescue ::NativeException CORBA::Exception.native2r($!) end end |