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

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

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

Ruby.getFileno介绍

[英]Get the "external" fileno for a given ChannelDescriptor. Primarily for the shared 0, 1, and 2 filenos, which we can't actually share across JRuby runtimes.
[中]获取给定ChannelDescriptor的“外部”文件号。主要针对共享的0、1和2文件号,我们实际上无法在JRuby运行时共享这些文件。

代码示例

代码示例来源: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: org.kill-bill.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: org.kill-bill.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

@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 "RubyFile(" + path + ", " + openFile.getMode() + ", " + getRuntime().getFileno(openFile.getMainStreamSafe().getDescriptor()) + ")";
  } catch (BadDescriptorException e) {
    throw getRuntime().newErrnoEBADFError();
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@Override
public IRubyObject inspect() {
  Ruby runtime = getRuntime();
  
  if (!runtime.is1_9()) return super.inspect();
  if (openFile == null) return super.inspect();
  
  Stream stream = openFile.getMainStream();
  String className = getMetaClass().getRealClass().getName();
  String path = openFile.getPath();
  String status = "";
  
  if (path == null) {
    if (stream == null) {
      path = "";
      status = "(closed)";
    } else {
      path = "fd " + runtime.getFileno(stream.getDescriptor());
    }
  } else if (!openFile.isOpen()) {
    status = " (closed)";
  }
  
  String inspectStr = "#<" + className + ":" + path + status + ">";
  
  return runtime.newString(inspectStr);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@Override
public IRubyObject inspect() {
  Ruby runtime = getRuntime();
  
  if (!runtime.is1_9()) return super.inspect();
  if (openFile == null) return super.inspect();
  
  Stream stream = openFile.getMainStream();
  String className = getMetaClass().getRealClass().getName();
  String path = openFile.getPath();
  String status = "";
  
  if (path == null) {
    if (stream == null) {
      path = "";
      status = "(closed)";
    } else {
      path = "fd " + runtime.getFileno(stream.getDescriptor());
    }
  } else if (!openFile.isOpen()) {
    status = " (closed)";
  }
  
  String inspectStr = "#<" + className + ":" + path + status + ">";
  
  return runtime.newString(inspectStr);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

if (runtime.getFileno(selfDescriptor) >= 0 && runtime.getFileno(selfDescriptor) <= 2) {
  selfStream.clearerr();

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

if (runtime.getFileno(selfDescriptor) >= 0 && runtime.getFileno(selfDescriptor) <= 2) {
  selfStream.clearerr();

相关文章

微信公众号

最新文章

更多

Ruby类方法