Module: R2CORBA::CORBA::Portable::OutputStream
- Defined in:
- lib/corba/cbase/Streams.rb,
lib/corba/jbase/Streams.rb
Constant Summary collapse
- @@wrapper_klass =
Class.new do include CORBA::Portable::OutputStream def initialize(jobj) @stream_ = jobj end attr_reader :stream_ end
Class Method Summary collapse
Instance Method Summary collapse
- #write_Abstract(value) ⇒ Object
- #write_any(value) ⇒ Object
- #write_boolean(value) ⇒ Object
- #write_boolean_array(value, offset, length) ⇒ Object
- #write_char(value) ⇒ Object
- #write_char_array(value, offset, length) ⇒ Object
- #write_construct(value, tc) ⇒ Object
- #write_double(value) ⇒ Object
- #write_double_array(value, offset, length) ⇒ Object
- #write_fixed(value) ⇒ Object
- #write_float(value) ⇒ Object
- #write_float_array(value, offset, length) ⇒ Object
- #write_long(value) ⇒ Object
- #write_long_array(value, offset, length) ⇒ Object
- #write_longlong(value) ⇒ Object
- #write_longlong_array(value, offset, length) ⇒ Object
- #write_member(tc, value) ⇒ Object
- #write_Object(value) ⇒ Object
- #write_octet(value) ⇒ Object
- #write_octet_array(value, offset, length) ⇒ Object
- #write_short(value) ⇒ Object
- #write_short_array(value, offset, length) ⇒ Object
- #write_string(value) ⇒ Object
- #write_TypeCode(value) ⇒ Object
- #write_ulong(value) ⇒ Object
- #write_ulong_array(value, offset, length) ⇒ Object
- #write_ulonglong(value) ⇒ Object
- #write_ulonglong_array(value, offset, length) ⇒ Object
- #write_ushort(value) ⇒ Object
- #write_ushort_array(value, offset, length) ⇒ Object
- #write_value(value) ⇒ Object (also: #write_Value)
- #write_valuebox(value, boxedvalue_helper) ⇒ Object
- #write_wchar(value) ⇒ Object
- #write_wchar_array(value, offset, length) ⇒ Object
- #write_wstring(value) ⇒ Object
Class Method Details
Instance Method Details
#write_Abstract(value) ⇒ Object
710 711 712 713 714 715 716 |
# File 'lib/corba/jbase/Streams.rb', line 710 def write_Abstract(value) begin self.stream_.write_abstract_interface(value.is_a?(CORBA::Object) ? value.objref_ : value) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_any(value) ⇒ Object
466 467 468 469 470 471 472 |
# File 'lib/corba/jbase/Streams.rb', line 466 def write_any(value) begin self.stream_.write_any(value) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_boolean(value) ⇒ Object
474 475 476 477 478 479 480 |
# File 'lib/corba/jbase/Streams.rb', line 474 def write_boolean(value) begin self.stream_.write_boolean(value) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_boolean_array(value, offset, length) ⇒ Object
482 483 484 485 486 487 488 |
# File 'lib/corba/jbase/Streams.rb', line 482 def write_boolean_array(value, offset, length) begin self.stream_.write_boolean_array(value.to_java(:boolean), offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_char(value) ⇒ Object
490 491 492 493 494 495 496 |
# File 'lib/corba/jbase/Streams.rb', line 490 def write_char(value) begin self.stream_.write_char(value[0]) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_char_array(value, offset, length) ⇒ Object
498 499 500 501 502 503 504 |
# File 'lib/corba/jbase/Streams.rb', line 498 def write_char_array(value, offset, length) begin self.stream_.write_char_array(value.collect{ |c| c[0] }.to_java(:char), offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_construct(value, tc) ⇒ Object
702 703 704 705 706 707 708 |
# File 'lib/corba/jbase/Streams.rb', line 702 def write_construct(value, tc) begin CORBA::Any.to_any(value, tc).to_java(self.stream_.orb).write_value(self.stream_) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_double(value) ⇒ Object
646 647 648 649 650 651 652 |
# File 'lib/corba/jbase/Streams.rb', line 646 def write_double(value) begin self.stream_.write_double(value) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_double_array(value, offset, length) ⇒ Object
654 655 656 657 658 659 660 |
# File 'lib/corba/jbase/Streams.rb', line 654 def write_double_array(value, offset, length) begin self.stream_.write_double_array(value.to_java(:double), offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_fixed(value) ⇒ Object
678 679 680 681 682 683 684 |
# File 'lib/corba/jbase/Streams.rb', line 678 def write_fixed(value) begin self.stream_.write_fixed(java.math.BigDecimal.new(value.to_s)) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_float(value) ⇒ Object
630 631 632 633 634 635 636 |
# File 'lib/corba/jbase/Streams.rb', line 630 def write_float(value) begin self.stream_.write_float(value) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_float_array(value, offset, length) ⇒ Object
638 639 640 641 642 643 644 |
# File 'lib/corba/jbase/Streams.rb', line 638 def write_float_array(value, offset, length) begin self.stream_.write_float_array(value.to_java(:float), offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_long(value) ⇒ Object
566 567 568 569 570 571 572 |
# File 'lib/corba/jbase/Streams.rb', line 566 def write_long(value) begin self.stream_.write_long(value) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_long_array(value, offset, length) ⇒ Object
574 575 576 577 578 579 580 |
# File 'lib/corba/jbase/Streams.rb', line 574 def write_long_array(value, offset, length) begin self.stream_.write_long_array(value.to_java(:int), offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_longlong(value) ⇒ Object
598 599 600 601 602 603 604 |
# File 'lib/corba/jbase/Streams.rb', line 598 def write_longlong(value) begin self.stream_.write_longlong(value) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_longlong_array(value, offset, length) ⇒ Object
606 607 608 609 610 611 612 |
# File 'lib/corba/jbase/Streams.rb', line 606 def write_longlong_array(value, offset, length) begin self.stream_.write_longlong_array(value.to_java(:long), offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_member(tc, value) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/corba/cbase/Streams.rb', line 73 def write_member(tc, value) tc = tc.resolved_tc # takes care of recursive typecodes case tc.kind when TK_ANY write_any(value) when TK_BOOLEAN write_boolean(value) when TK_SHORT write_short(value) when TK_LONG write_long(value) when TK_USHORT write_ushort(value) when TK_WCHAR write_wchar(value) when TK_ULONG write_ulong(value) when TK_LONGLONG write_longlong(value) when TK_ULONGLONG write_ulonglong(value) when TK_OCTET write_octet(value) when TK_FLOAT write_float(value) when TK_DOUBLE write_double(value) when TK_LONGDOUBLE raise CORBA::NO_IMPLEMENT.new('LongDouble not supported', 0, CORBA::COMPLETED_NO) when TK_FIXED write_fixed(value) when TK_CHAR write_char(value) when TK_STRING write_string(value) when TK_WSTRING write_wstring(value) when TK_OBJREF write_Object(value) when TK_TYPECODE write_TypeCode(value) when TK_ARRAY, TK_SEQUENCE, TK_ENUM, TK_STRUCT, TK_EXCEPT, TK_UNION, TK_PRINCIPAL write_construct(value, tc) when TK_ABSTRACT_INTERFACE write_Abstract(value) when TK_VALUE, TK_VALUE_BOX, TK_EVENT write_Value(value) ## TODO: TK_NATIVE end end |
#write_Object(value) ⇒ Object
686 687 688 689 690 691 692 |
# File 'lib/corba/jbase/Streams.rb', line 686 def write_Object(value) begin self.stream_.write_Object(value.objref_) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_octet(value) ⇒ Object
518 519 520 521 522 523 524 |
# File 'lib/corba/jbase/Streams.rb', line 518 def write_octet(value) begin self.stream_.write_octet([value].pack('C').unpack('c').first) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_octet_array(value, offset, length) ⇒ Object
526 527 528 529 530 531 532 |
# File 'lib/corba/jbase/Streams.rb', line 526 def write_octet_array(value, offset, length) begin self.stream_.write_octet_array(value.pack('C*').unpack('c*').to_java(:byte), offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_short(value) ⇒ Object
534 535 536 537 538 539 540 |
# File 'lib/corba/jbase/Streams.rb', line 534 def write_short(value) begin self.stream_.write_short(value) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_short_array(value, offset, length) ⇒ Object
542 543 544 545 546 547 548 |
# File 'lib/corba/jbase/Streams.rb', line 542 def write_short_array(value, offset, length) begin self.stream_.write_short_array(value.to_java(:short), offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_string(value) ⇒ Object
662 663 664 665 666 667 668 |
# File 'lib/corba/jbase/Streams.rb', line 662 def write_string(value) begin self.stream_.write_string(value) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_TypeCode(value) ⇒ Object
694 695 696 697 698 699 700 |
# File 'lib/corba/jbase/Streams.rb', line 694 def write_TypeCode(value) begin self.stream_.write_TypeCode(value.tc_) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_ulong(value) ⇒ Object
582 583 584 585 586 587 588 |
# File 'lib/corba/jbase/Streams.rb', line 582 def write_ulong(value) begin self.stream_.write_ulong([value].pack('L').unpack('l').first) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_ulong_array(value, offset, length) ⇒ Object
590 591 592 593 594 595 596 |
# File 'lib/corba/jbase/Streams.rb', line 590 def write_ulong_array(value, offset, length) begin self.stream_.write_ulong_array(value.pack('L*').unpack('l*').to_java(:int), offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_ulonglong(value) ⇒ Object
614 615 616 617 618 619 620 |
# File 'lib/corba/jbase/Streams.rb', line 614 def write_ulonglong(value) begin self.stream_.write_ulonglong([value].pack('Q').unpack('q').first) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_ulonglong_array(value, offset, length) ⇒ Object
622 623 624 625 626 627 628 |
# File 'lib/corba/jbase/Streams.rb', line 622 def write_ulonglong_array(value, offset, length) begin self.stream_.write_ulonglong_array(value.pack('Q*').unpack('q*').to_java(:long), offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_ushort(value) ⇒ Object
550 551 552 553 554 555 556 |
# File 'lib/corba/jbase/Streams.rb', line 550 def write_ushort(value) begin self.stream_.write_ushort([value].pack('S').unpack('s').first) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_ushort_array(value, offset, length) ⇒ Object
558 559 560 561 562 563 564 |
# File 'lib/corba/jbase/Streams.rb', line 558 def write_ushort_array(value, offset, length) begin self.stream_.write_ushort_array(value.pack('S*').unpack('s*').to_java(:short), offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_value(value) ⇒ Object Also known as: write_Value
718 719 720 721 722 723 724 |
# File 'lib/corba/jbase/Streams.rb', line 718 def write_value(value) begin self.stream_.write_value(value) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_valuebox(value, boxedvalue_helper) ⇒ Object
726 727 728 729 730 731 732 |
# File 'lib/corba/jbase/Streams.rb', line 726 def write_valuebox(value, boxedvalue_helper) begin self.stream_.write_value(value, boxedvalue_helper) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_wchar(value) ⇒ Object
506 507 508 |
# File 'lib/corba/jbase/Streams.rb', line 506 def write_wchar(value) self.stream_.write_wchar(value) end |
#write_wchar_array(value, offset, length) ⇒ Object
510 511 512 513 514 515 516 |
# File 'lib/corba/jbase/Streams.rb', line 510 def write_wchar_array(value, offset, length) begin self.stream_.write_wchar_array(value.to_java(:char), offset, length) rescue ::NativeException CORBA::Exception.native2r($!) end end |
#write_wstring(value) ⇒ Object
670 671 672 673 674 675 676 |
# File 'lib/corba/jbase/Streams.rb', line 670 def write_wstring(value) begin self.stream_.write_wstring(value.inject('') { |s, b| s << b.chr }) rescue ::NativeException CORBA::Exception.native2r($!) end end |