Class List Method List File List

# Class: Vertx::DatagramSocket

Inherits:
  Object
  - Object
  - Vertx::DatagramSocket
  show all
Includes:
  Measured, ReadStream
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb

## Instance Method Summary (collapse)

- - (Object) block_multicast_group(multicastAddress = nil, networkInterface = nil, sourceToBlock = nil)
- - (Object) close
- - (Object) end_handler
- - (Object) exception_handler
- - (Object) handler
- - (DatagramSocket) initialize(j_del) constructor
  A new instance of DatagramSocket.
- - (Object) j_del
- - (Object) listen(port = nil, host = nil)
- - (Object) listen_multicast_group(multicastAddress = nil, networkInterface = nil, source = nil)
- - (Object) local_address
- - (Boolean) metrics_enabled?
- - (Object) pause
- - (Object) resume
- - (Object) send(param_1 = nil, param_2 = nil, param_3 = nil, param_4 = nil)
- - (Object) sender(port = nil, host = nil)
- - (Object) unlisten_multicast_group(multicastAddress = nil, networkInterface = nil, source = nil)

## Constructor Details

### - (`DatagramSocket`) initialize(j_del)

Returns a new instance of DatagramSocket

    25
    26
    27
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 25

    def initialize(j_del)
      @j_del = j_del
    end

## Instance Method Details

### - (`Object`) block_multicast_group(multicastAddress = nil, networkInterface = nil, sourceToBlock = nil)

Raises:

- (`ArgumentError`)

    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 149

    def block_multicast_group(multicastAddress=nil,networkInterface=nil,sourceToBlock=nil)
      if multicastAddress.class == String && networkInterface.class == String && block_given? && sourceToBlock == nil
        @j_del.java_method(:blockMulticastGroup, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(multicastAddress,networkInterface,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::DatagramSocket) : nil) }))
        return self
      elsif multicastAddress.class == String && networkInterface.class == String && sourceToBlock.class == String && block_given?
        @j_del.java_method(:blockMulticastGroup, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(multicastAddress,networkInterface,sourceToBlock,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::DatagramSocket) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling block_multicast_group(multicastAddress,networkInterface,sourceToBlock)"
    end

### - (`Object`) close

Raises:

- (`ArgumentError`)

    88
    89
    90
    91
    92
    93
    94
    95
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 88

    def close
      if !block_given?
        return @j_del.java_method(:close, []).call()
      elsif block_given?
        return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling close()"
    end

### - (`Object`) end_handler

Raises:

- (`ArgumentError`)

    189
    190
    191
    192
    193
    194
    195
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 189

    def end_handler
      if block_given?
        @j_del.java_method(:endHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling end_handler()"
    end

### - (`Object`) exception_handler

Raises:

- (`ArgumentError`)

    207
    208
    209
    210
    211
    212
    213
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 207

    def exception_handler
      if block_given?
        @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling exception_handler()"
    end

### - (`Object`) handler

Raises:

- (`ArgumentError`)

    198
    199
    200
    201
    202
    203
    204
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 198

    def handler
      if block_given?
        @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::DatagramPacket)) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling handler()"
    end

### - (`Object`) j_del

    30
    31
    32
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 30

    def j_del
      @j_del
    end

### - (`Object`) listen(port = nil, host = nil)

Raises:

- (`ArgumentError`)

    164
    165
    166
    167
    168
    169
    170
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 164

    def listen(port=nil,host=nil)
      if port.class == Fixnum && host.class == String && block_given?
        @j_del.java_method(:listen, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(port,host,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::DatagramSocket) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling listen(port,host)"
    end

### - (`Object`) listen_multicast_group(multicastAddress = nil, networkInterface = nil, source = nil)

Raises:

- (`ArgumentError`)

    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 115

    def listen_multicast_group(multicastAddress=nil,networkInterface=nil,source=nil)
      if multicastAddress.class == String && block_given? && networkInterface == nil && source == nil
        @j_del.java_method(:listenMulticastGroup, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(multicastAddress,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::DatagramSocket) : nil) }))
        return self
      elsif multicastAddress.class == String && networkInterface.class == String && source.class == String && block_given?
        @j_del.java_method(:listenMulticastGroup, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(multicastAddress,networkInterface,source,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::DatagramSocket) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling listen_multicast_group(multicastAddress,networkInterface,source)"
    end

### - (`Object`) local_address

Raises:

- (`ArgumentError`)

    99
    100
    101
    102
    103
    104
    105
    106
    107
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 99

    def local_address
      if !block_given?
        if @cached_local_address != nil
          return @cached_local_address
        end
        return @cached_local_address = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:localAddress, []).call(),::Vertx::SocketAddress)
      end
      raise ArgumentError, "Invalid arguments when calling local_address()"
    end

### - (`Boolean`) metrics_enabled?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

    35
    36
    37
    38
    39
    40
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 35

    def metrics_enabled?
      if !block_given?
        return @j_del.java_method(:isMetricsEnabled, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling metrics_enabled?()"
    end

### - (`Object`) pause

Raises:

- (`ArgumentError`)

    172
    173
    174
    175
    176
    177
    178
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 172

    def pause
      if !block_given?
        @j_del.java_method(:pause, []).call()
        return self
      end
      raise ArgumentError, "Invalid arguments when calling pause()"
    end

### - (`Object`) resume

Raises:

- (`ArgumentError`)

    180
    181
    182
    183
    184
    185
    186
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 180

    def resume
      if !block_given?
        @j_del.java_method(:resume, []).call()
        return self
      end
      raise ArgumentError, "Invalid arguments when calling resume()"
    end

### - (`Object`) send(param_1 = nil, param_2 = nil, param_3 = nil, param_4 = nil)

Raises:

- (`ArgumentError`)

    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 60

    def send(param_1=nil,param_2=nil,param_3=nil,param_4=nil)
      if param_1.class.method_defined?(:j_del) && param_2.class == Fixnum && param_3.class == String && block_given? && param_4 == nil
        @j_del.java_method(:send, [Java::IoVertxCoreBuffer::Buffer.java_class,Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.j_del,param_2,param_3,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::DatagramSocket) : nil) }))
        return self
      elsif param_1.class == String && param_2.class == Fixnum && param_3.class == String && block_given? && param_4 == nil
        @j_del.java_method(:send, [Java::java.lang.String.java_class,Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,param_2,param_3,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::DatagramSocket) : nil) }))
        return self
      elsif param_1.class == String && param_2.class == String && param_3.class == Fixnum && param_4.class == String && block_given?
        @j_del.java_method(:send, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,param_2,param_3,param_4,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::DatagramSocket) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling send(param_1,param_2,param_3,param_4)"
    end

### - (`Object`) sender(port = nil, host = nil)

Raises:

- (`ArgumentError`)

    78
    79
    80
    81
    82
    83
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 78

    def sender(port=nil,host=nil)
      if port.class == Fixnum && host.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:sender, [Java::int.java_class,Java::java.lang.String.java_class]).call(port,host),::Vertx::PacketWritestream)
      end
      raise ArgumentError, "Invalid arguments when calling sender(port,host)"
    end

### - (`Object`) unlisten_multicast_group(multicastAddress = nil, networkInterface = nil, source = nil)

Raises:

- (`ArgumentError`)

    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_socket.rb', line 132

    def unlisten_multicast_group(multicastAddress=nil,networkInterface=nil,source=nil)
      if multicastAddress.class == String && block_given? && networkInterface == nil && source == nil
        @j_del.java_method(:unlistenMulticastGroup, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(multicastAddress,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::DatagramSocket) : nil) }))
        return self
      elsif multicastAddress.class == String && networkInterface.class == String && source.class == String && block_given?
        @j_del.java_method(:unlistenMulticastGroup, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(multicastAddress,networkInterface,source,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::DatagramSocket) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling unlisten_multicast_group(multicastAddress,networkInterface,source)"
    end