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

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

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

Ruby.newFileStat介绍

暂无

代码示例

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

@JRubyMethod
public IRubyObject lstat(ThreadContext context) {
  checkClosed(context);
  return context.runtime.newFileStat(path, true);
}

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

@JRubyMethod
public IRubyObject ctime(ThreadContext context) {
  checkClosed(context);
  return context.runtime.newFileStat(path, false).ctime();
}

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

@JRubyMethod
public IRubyObject mtime(ThreadContext context) {
  checkClosed(context);
  return context.runtime.newFileStat(path, false).mtime();
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod
public IRubyObject lstat(ThreadContext context) {
  checkClosed(context);
  return context.runtime.newFileStat(getPath(), true);
}

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

@JRubyMethod
public IRubyObject ctime(ThreadContext context) {
  checkClosed(context);
  return context.runtime.newFileStat(path, false).ctime();
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod
public IRubyObject atime(ThreadContext context) {
  checkClosed(context);
  return context.runtime.newFileStat(getPath(), false).atime();
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(name = "stat", required = 1, meta = true)
public static IRubyObject stat(ThreadContext context, IRubyObject recv, IRubyObject filename) {
  Ruby runtime = context.runtime;
  String f = StringSupport.checkEmbeddedNulls(runtime, get_path(context, filename)).getUnicodeValue();
  return runtime.newFileStat(f, false);
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "ctime")
public IRubyObject ctime(ThreadContext context) {
  checkClosed(context);
  return context.runtime.newFileStat(getPath(), false).ctime();
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "lstat", required = 1, meta = true)
public static IRubyObject lstat(ThreadContext context, IRubyObject recv, IRubyObject filename) {
  Ruby runtime = context.runtime;
  String f = StringSupport.checkEmbeddedNulls(runtime, get_path(context, filename)).getUnicodeValue();
  return runtime.newFileStat(f, true);
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "ctime", required = 1, meta = true)
public static IRubyObject ctime(ThreadContext context, IRubyObject recv, IRubyObject filename) {
  Ruby runtime = context.runtime;
  String f = StringSupport.checkEmbeddedNulls(runtime, get_path(context, filename)).getUnicodeValue();
  return runtime.newFileStat(f, false).ctime();
}

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

@JRubyMethod(name = {"size", "length"}, compat = CompatVersion.RUBY1_8)
@Override
public IRubyObject size(ThreadContext context) {
  if (!isClosed()) {
    flush();
    return context.runtime.newFileStat(path, false).size();
  }
  return RubyFixnum.zero(context.runtime);
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "ftype", required = 1, meta = true)
public static IRubyObject ftype(ThreadContext context, IRubyObject recv, IRubyObject filename) {
  Ruby runtime = context.runtime;
  RubyString path = StringSupport.checkEmbeddedNulls(runtime, get_path(context, filename));
  return runtime.newFileStat(path.getUnicodeValue(), true).ftype();
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "atime", required = 1, meta = true)
public static IRubyObject atime(ThreadContext context, IRubyObject recv, IRubyObject filename) {
  Ruby runtime = context.runtime;
  String f = StringSupport.checkEmbeddedNulls(runtime, get_path(context, filename)).getUnicodeValue();
  return runtime.newFileStat(f, false).atime();
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "birthtime", required = 1, meta = true)
public static IRubyObject birthtime(ThreadContext context, IRubyObject recv, IRubyObject filename) {
  Ruby runtime = context.runtime;
  String f = StringSupport.checkEmbeddedNulls(runtime, get_path(context, filename)).getUnicodeValue();
  return runtime.newFileStat(f, false).birthtime();
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(required = 1, meta = true)
public static IRubyObject mtime(ThreadContext context, IRubyObject recv, IRubyObject filename) {
  Ruby runtime = context.runtime;
  String f = StringSupport.checkEmbeddedNulls(runtime, get_path(context, filename)).getUnicodeValue();
  return runtime.newFileStat(f, false).mtime();
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(name = "atime", required = 1, meta = true)
public static IRubyObject atime(ThreadContext context, IRubyObject recv, IRubyObject filename) {
  Ruby runtime = context.runtime;
  String f = StringSupport.checkEmbeddedNulls(runtime, get_path(context, filename)).getUnicodeValue();
  return runtime.newFileStat(f, false).atime();
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(name = "birthtime", required = 1, meta = true)
public static IRubyObject birthtime(ThreadContext context, IRubyObject recv, IRubyObject filename) {
  Ruby runtime = context.runtime;
  String f = StringSupport.checkEmbeddedNulls(runtime, get_path(context, filename)).getUnicodeValue();
  return runtime.newFileStat(f, false).birthtime();
}

代码示例来源: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.jruby/jruby-core

@JRubyMethod(name = "empty?", meta = true)
public static IRubyObject empty_p(ThreadContext context, IRubyObject recv, IRubyObject arg) {
  Ruby runtime = context.runtime;
  RubyString path = StringSupport.checkEmbeddedNulls(runtime, RubyFile.get_path(context, arg));
  RubyFileStat fileStat = runtime.newFileStat(path.asJavaString(), false);
  boolean isDirectory = fileStat.directory_p().isTrue();
  return runtime.newBoolean(isDirectory && entries(context, recv, arg).getLength() <= 2);
}

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

@JRubyMethod(name = {"exists?", "exist?"}, meta = true, compat = RUBY1_9)
public static IRubyObject exist(ThreadContext context, IRubyObject recv, IRubyObject arg) {
  // Capture previous exception if any.
  IRubyObject exception = context.runtime.getGlobalVariables().get("$!");
  try {
    return context.runtime.newFileStat(RubyFile.get_path(context, arg).asJavaString(), false).directory_p();
  } catch (Exception e) {
    // Restore $!
    context.runtime.getGlobalVariables().set("$!", exception);
    return context.runtime.newBoolean(false);
  }
}

相关文章

Ruby类方法