Class: Vertx::SocketAddress

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/socket_address.rb

Overview

The address of a socket, an inet socket address or a domain socket address.

Use #inet_socket_address to create an inet socket address and #domain_socket_address to create a domain socket address

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


20
21
22
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/socket_address.rb', line 20

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

+ (::Vertx::SocketAddress) domain_socket_address(path = nil)

Create a domain socket address.

Parameters:

  • path (String) (defaults to: nil)
    the address path

Returns:

Raises:

  • (ArgumentError)


49
50
51
52
53
54
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/socket_address.rb', line 49

def self.domain_socket_address(path=nil)
  if path.class == String && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCoreNet::SocketAddress.java_method(:domainSocketAddress, [Java::java.lang.String.java_class]).call(path),::Vertx::SocketAddress)
  end
  raise ArgumentError, "Invalid arguments when calling domain_socket_address(#{path})"
end

+ (::Vertx::SocketAddress) inet_socket_address(port = nil, host = nil)

Create a inet socket address, host must be non null and port must be between 0 and 65536.

Parameters:

  • port (Fixnum) (defaults to: nil)
    the address port
  • host (String) (defaults to: nil)
    the address host

Returns:

Raises:

  • (ArgumentError)


40
41
42
43
44
45
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/socket_address.rb', line 40

def self.inet_socket_address(port=nil,host=nil)
  if port.class == Fixnum && host.class == String && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCoreNet::SocketAddress.java_method(:inetSocketAddress, [Java::int.java_class,Java::java.lang.String.java_class]).call(port,host),::Vertx::SocketAddress)
  end
  raise ArgumentError, "Invalid arguments when calling inet_socket_address(#{port},#{host})"
end

+ (Object) j_api_type



29
30
31
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/socket_address.rb', line 29

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



32
33
34
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/socket_address.rb', line 32

def self.j_class
  Java::IoVertxCoreNet::SocketAddress.java_class
end

+ (Object) unwrap(obj)



26
27
28
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/socket_address.rb', line 26

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

+ (Object) wrap(obj)



23
24
25
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/socket_address.rb', line 23

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

Instance Method Details

- (String) host

Returns the address host or null for a domain socket

Returns:

  • (String)
    the address host or null for a domain socket

Raises:

  • (ArgumentError)


56
57
58
59
60
61
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/socket_address.rb', line 56

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

- (String) path

Returns the address path or null for a inet socket

Returns:

  • (String)
    the address path or null for a inet socket

Raises:

  • (ArgumentError)


70
71
72
73
74
75
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/socket_address.rb', line 70

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

- (Fixnum) port

Returns the address port or -1 for a domain socket

Returns:

  • (Fixnum)
    the address port or -1 for a domain socket

Raises:

  • (ArgumentError)


63
64
65
66
67
68
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/socket_address.rb', line 63

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