org.jruby.Ruby.newErrnoEBADFError()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中org.jruby.Ruby.newErrnoEBADFError方法的一些代码示例,展示了Ruby.newErrnoEBADFError的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newErrnoEBADFError方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newErrnoEBADFError

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();
  }
}

相关文章

Ruby类方法