Class List Method List File List

# Class: Vertx::DatagramPacket

Inherits:
  Object
  - Object
  - Vertx::DatagramPacket
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_packet.rb

## Overview

A received datagram packet (UDP) which contains the data and information about the sender of the data itself.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (::Vertx::Buffer) data
  Returns the data of the DatagramPacket.
- - (::Vertx::SocketAddress) sender
  Returns the SocketAddress of the sender that sent this DatagramPacket.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    19
    20
    21
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_packet.rb', line 19

    def @@j_api_type.accept?(obj)
      obj.class == DatagramPacket
    end

### + (`Object`) j_api_type

    28
    29
    30
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_packet.rb', line 28

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

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

    def self.j_class
      Java::IoVertxCoreDatagram::DatagramPacket.java_class
    end

### + (`Object`) unwrap(obj)

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

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    22
    23
    24
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_packet.rb', line 22

    def @@j_api_type.wrap(obj)
      DatagramPacket.new(obj)
    end

## Instance Method Details

### - (`::Vertx::Buffer`) data

Returns the data of the Vertx::DatagramPacket

Returns:

- (`::Vertx::Buffer`) —
  the data

Raises:

- (`ArgumentError`)

    45
    46
    47
    48
    49
    50
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_packet.rb', line 45

    def data
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:data, []).call(),::Vertx::Buffer)
      end
      raise ArgumentError, "Invalid arguments when calling data()"
    end

### - (`::Vertx::SocketAddress`) sender

Returns the SocketAddress of the sender that sent this Vertx::DatagramPacket.

Returns:

- (`::Vertx::SocketAddress`) —
  the address of the sender

Raises:

- (`ArgumentError`)

    37
    38
    39
    40
    41
    42
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/datagram_packet.rb', line 37

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