本文整理了Java中org.jruby.Ruby.newErrnoEBADFError
方法的一些代码示例,展示了Ruby.newErrnoEBADFError
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newErrnoEBADFError
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newErrnoEBADFError
暂无
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
protected IRubyObject getSocknameCommon(ThreadContext context, String caller) {
try {
InetSocketAddress sock = getSocketAddress();
return Sockaddr.packSockaddrFromAddress(context, sock);
} catch (BadDescriptorException e) {
throw context.runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Override
protected IRubyObject getSocknameCommon(ThreadContext context, String caller) {
try {
InetSocketAddress sock = getSocketAddress();
return Sockaddr.packSockaddrFromAddress(context, sock);
} catch (BadDescriptorException e) {
throw context.runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject getpeername(ThreadContext context) {
try {
InetSocketAddress sock = getRemoteSocket();
return Sockaddr.packSockaddrFromAddress(context, sock);
} catch (BadDescriptorException e) {
throw context.runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public boolean getBlocking() {
try {
return ((ChannelStream) openFile.getMainStreamSafe()).isBlocking();
} catch (BadDescriptorException e) {
throw getRuntime().newErrnoEBADFError();
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public boolean getBlocking() {
try {
return ((ChannelStream) openFile.getMainStreamSafe()).isBlocking();
} catch (BadDescriptorException e) {
throw getRuntime().newErrnoEBADFError();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private IRubyObject addrCommon(ThreadContext context, boolean reverse) {
try {
InetSocketAddress address = getSocketAddress();
if (address == null) {
throw context.runtime.newErrnoENOTSOCKError("Not socket or not connected");
}
return addrFor(context, address, reverse);
} catch (BadDescriptorException e) {
throw context.runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private IRubyObject peeraddrCommon(ThreadContext context, boolean reverse) {
try {
InetSocketAddress address = getRemoteSocket();
if (address == null) {
throw context.runtime.newErrnoENOTSOCKError("Not socket or not connected");
}
return addrFor(context, address, reverse);
} catch (BadDescriptorException e) {
throw context.runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
protected IRubyObject getSocknameCommon(ThreadContext context, String caller) {
try {
InetSocketAddress sock = getSocketAddress();
if(null == sock) {
return Sockaddr.pack_sockaddr_in(context, 0, "0.0.0.0");
} else {
return Sockaddr.pack_sockaddr_in(context, sock);
}
} catch (BadDescriptorException e) {
throw context.runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public OutputStream getOutStream() {
try {
return getOpenFileChecked().getMainStreamSafe().newOutputStream();
} catch (BadDescriptorException e) {
throw getRuntime().newErrnoEBADFError();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public InputStream getInStream() {
try {
return getOpenFileChecked().getMainStreamSafe().newInputStream();
} catch (BadDescriptorException e) {
throw getRuntime().newErrnoEBADFError();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/** Returns the current sync mode.
*
* @return the current sync mode.
*/
@JRubyMethod(name = "sync")
public RubyBoolean sync(ThreadContext context) {
try {
return context.runtime.newBoolean(getOpenFileChecked().getMainStreamSafe().isSync());
} catch (BadDescriptorException e) {
throw context.runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "fileno", alias = "to_i")
public RubyFixnum fileno(ThreadContext context) {
Ruby runtime = context.runtime;
// map to external fileno
try {
return runtime.newFixnum(runtime.getFileno(getOpenFileChecked().getMainStreamSafe().getDescriptor()));
} catch (BadDescriptorException e) {
throw runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "fileno", alias = "to_i")
public RubyFixnum fileno(ThreadContext context) {
Ruby runtime = context.runtime;
// map to external fileno
try {
return runtime.newFixnum(runtime.getFileno(getOpenFileChecked().getMainStreamSafe().getDescriptor()));
} catch (BadDescriptorException e) {
throw runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public String toString() {
try {
return "RubyIO(" + openFile.getMode() + ", " + getRuntime().getFileno(openFile.getMainStreamSafe().getDescriptor()) + ")";
} catch (BadDescriptorException e) {
throw getRuntime().newErrnoEBADFError();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public String toString() {
try {
return "RubyFile(" + path + ", " + openFile.getMode() + ", " + getRuntime().getFileno(openFile.getMainStreamSafe().getDescriptor()) + ")";
} catch (BadDescriptorException e) {
throw getRuntime().newErrnoEBADFError();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod
public IRubyObject stat(ThreadContext context) {
openFile.checkClosed(context.runtime);
try {
return context.runtime.newFileStat(getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor());
} catch (BadDescriptorException e) {
throw context.runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod
public IRubyObject stat(ThreadContext context) {
openFile.checkClosed(context.runtime);
try {
return context.runtime.newFileStat(getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor());
} catch (BadDescriptorException e) {
throw context.runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = {"tty?", "isatty"})
public RubyBoolean tty_p(ThreadContext context) {
try {
return context.runtime.newBoolean(
context.runtime.getPosix().isatty(
getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor()));
} catch (BadDescriptorException e) {
throw context.runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = {"tty?", "isatty"})
public RubyBoolean tty_p(ThreadContext context) {
try {
return context.runtime.newBoolean(
context.runtime.getPosix().isatty(
getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor()));
} catch (BadDescriptorException e) {
throw context.runtime.newErrnoEBADFError();
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
protected void init_sock(Ruby runtime) {
try {
ModeFlags modes = newModeFlags(runtime, ModeFlags.RDWR);
MakeOpenFile();
openFile.setMainStream(ChannelStream.open(runtime, new ChannelDescriptor(channel, modes)));
openFile.setPipeStream(openFile.getMainStreamSafe());
openFile.setMode(modes.getOpenFileFlags());
openFile.getMainStreamSafe().setSync(true);
} catch (BadDescriptorException e) {
throw runtime.newErrnoEBADFError();
}
}
内容来源于网络,如有侵权,请联系作者删除!