public final String toString() { return description(); } public static NameInfo valueOf(long value) {
public final String toString() { return description(); } public static NameInfo valueOf(long value) {
public final String toString() { return description(); } public static NameInfo valueOf(long value) {
@JRubyMethod(optional = 1) public IRubyObject getnameinfo(ThreadContext context, IRubyObject[] args) { Ruby runtime = context.runtime; RubyString hostname; InetSocketAddress inet = getInetSocketAddress(); if (inet != null) { hostname = runtime.newString(inet.getHostName()); } else { UnixSocketAddress unix = getUnixSocketAddress(); hostname = runtime.newString(unix.path()); } RubyString rubyService = null; if (args.length > 0) { int flags = args[0].convertToInteger().getIntValue(); if ((flags & NameInfo.NI_NUMERICSERV.intValue()) != 0) { rubyService = runtime.newString(Integer.toString(getPort())); } } if (rubyService == null) { Service service = Service.getServiceByPort(getPort(), protocol.getName()); rubyService = runtime.newString(service.getName()); } return runtime.newArray(hostname, rubyService); }
@JRubyMethod(optional = 1) public IRubyObject getnameinfo(ThreadContext context, IRubyObject[] args) { Ruby runtime = context.runtime; RubyString hostname; InetSocketAddress inet = getInetSocketAddress(); if (inet != null) { hostname = runtime.newString(inet.getHostName()); } else { UnixSocketAddress unix = getUnixSocketAddress(); hostname = runtime.newString(unix.path()); } RubyString rubyService = null; if (args.length > 0) { int flags = args[0].convertToInteger().getIntValue(); if ((flags & NameInfo.NI_NUMERICSERV.intValue()) != 0) { rubyService = runtime.newString(Integer.toString(getPort())); } } if (rubyService == null) { Service service = Service.getServiceByPort(getPort(), protocol.getName()); rubyService = runtime.newString(service.getName()); } return runtime.newArray(hostname, rubyService); }