本文整理了Java中org.jruby.Ruby.newErrnoEAFNOSUPPORTError
方法的一些代码示例,展示了Ruby.newErrnoEAFNOSUPPORTError
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newErrnoEAFNOSUPPORTError
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newErrnoEAFNOSUPPORTError
暂无
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(visibility = Visibility.PRIVATE)
public IRubyObject initialize(ThreadContext context, IRubyObject _family) {
AddressFamily family = SocketUtils.addressFamilyFromArg(_family);
if (family == AddressFamily.AF_INET) {
explicitFamily = Inet4Address.class;
return initialize(context, StandardProtocolFamily.INET);
} else if (family == AddressFamily.AF_INET6) {
explicitFamily = Inet6Address.class;
return initialize(context, StandardProtocolFamily.INET6);
}
throw context.runtime.newErrnoEAFNOSUPPORTError("invalid family for UDPSocket: " + _family);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(visibility = Visibility.PRIVATE)
public IRubyObject initialize(ThreadContext context, IRubyObject _family) {
AddressFamily family = SocketUtils.addressFamilyFromArg(_family);
if (family == AddressFamily.AF_INET) {
explicitFamily = Inet4Address.class;
return initialize(context, StandardProtocolFamily.INET);
} else if (family == AddressFamily.AF_INET6) {
explicitFamily = Inet6Address.class;
return initialize(context, StandardProtocolFamily.INET6);
}
throw context.runtime.newErrnoEAFNOSUPPORTError("invalid family for UDPSocket: " + _family);
}
代码示例来源:origin: org.jruby/jruby-complete
public IRubyObject initialize(ThreadContext context, ProtocolFamily family) {
Ruby runtime = context.runtime;
try {
this.family = family;
DatagramChannel channel = DatagramChannel.open(family);
initSocket(newChannelFD(runtime, channel));
} catch (ConnectException e) {
throw runtime.newErrnoECONNREFUSEDError();
} catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "initialize: name or service not known");
} catch (UnsupportedOperationException uoe) {
if (uoe.getMessage().contains("IPv6 not available")) {
throw runtime.newErrnoEAFNOSUPPORTError("socket(2) - udp");
}
throw sockerr(runtime, "UnsupportedOperationException: " + uoe.getLocalizedMessage(), uoe);
} catch (IOException e) {
throw sockerr(runtime, "initialize: name or service not known", e);
}
return this;
}
代码示例来源:origin: org.jruby/jruby-core
public IRubyObject initialize(ThreadContext context, ProtocolFamily family) {
Ruby runtime = context.runtime;
try {
this.family = family;
DatagramChannel channel = DatagramChannel.open(family);
initSocket(newChannelFD(runtime, channel));
} catch (ConnectException e) {
throw runtime.newErrnoECONNREFUSEDError();
} catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "initialize: name or service not known");
} catch (UnsupportedOperationException uoe) {
if (uoe.getMessage().contains("IPv6 not available")) {
throw runtime.newErrnoEAFNOSUPPORTError("socket(2) - udp");
}
throw sockerr(runtime, "UnsupportedOperationException: " + uoe.getLocalizedMessage(), uoe);
} catch (IOException e) {
throw sockerr(runtime, "initialize: name or service not known", e);
}
return this;
}
内容来源于网络,如有侵权,请联系作者删除!