本文整理了Java中org.jruby.Ruby.getFile
方法的一些代码示例,展示了Ruby.getFile
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getFile
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getFile
[英]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
@JRubyMethod
public IRubyObject make_link(ThreadContext context, IRubyObject old) {
IRubyObject[] args = new IRubyObject[] { old, path };
return context.runtime.getFile().callMethod(context, "link", args);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod
public IRubyObject make_symlink(ThreadContext context, IRubyObject old) {
IRubyObject[] args = new IRubyObject[] { old, path };
return context.runtime.getFile().callMethod(context, "symlink", args);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod
public IRubyObject make_link(ThreadContext context, IRubyObject old) {
IRubyObject[] args = new IRubyObject[] { old, path };
return context.runtime.getFile().callMethod(context, "link", args);
}
代码示例来源:origin: org.jruby/jruby-complete
public static RubyClass createTempfileClass(Ruby runtime) {
RubyClass tempfileClass = runtime.defineClass("Tempfile", runtime.getFile(), TEMPFILE_ALLOCATOR);
tempfileClass.defineAnnotatedMethods(Tempfile.class);
return tempfileClass;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod
public IRubyObject make_link(ThreadContext context, IRubyObject old) {
IRubyObject[] args = new IRubyObject[] { old, getPath()};
return context.runtime.getFile().callMethod(context, "link", args);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(alias = "fnmatch?", required = 1, optional = 1)
public IRubyObject fnmatch(ThreadContext context, IRubyObject[] args) {
args = insertPath(args, 1);
return context.runtime.getFile().callMethod(context, "fnmatch?", args);
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(alias = "fnmatch?", required = 1, optional = 1)
public IRubyObject fnmatch(ThreadContext context, IRubyObject[] args) {
args = insertPath(args, 1);
return context.runtime.getFile().callMethod(context, "fnmatch?", args);
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod
public IRubyObject make_symlink(ThreadContext context, IRubyObject old) {
IRubyObject[] args = new IRubyObject[] { old, getPath()};
return context.runtime.getFile().callMethod(context, "symlink", args);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod
public IRubyObject make_symlink(ThreadContext context, IRubyObject old) {
IRubyObject[] args = new IRubyObject[] { old, getPath()};
return context.runtime.getFile().callMethod(context, "symlink", args);
}
代码示例来源:origin: org.jruby/jruby-complete
private static RubyString doJoin(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
final Ruby runtime = context.runtime;
final String separator = runtime.getFile().getConstant("SEPARATOR").toString();
final RubyArray argsAry = RubyArray.newArrayMayCopy(runtime, args);
final StringBuilder buffer = new StringBuilder(24);
boolean isTainted = joinImpl(buffer, separator, context, recv, argsAry);
RubyString fixedStr = new RubyString(runtime, runtime.getString(), buffer);
fixedStr.setTaint(isTainted);
return fixedStr;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod
public IRubyObject sub_ext(ThreadContext context, IRubyObject newExt) {
IRubyObject ext = context.runtime.getFile().callMethod(context, "extname", path);
IRubyObject newPath = path.chomp(context, ext).callMethod(context, "+", newExt);
return newInstance(context, newPath);
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "open", required = 1, optional = 1, meta = true)
public static IRubyObject open19(final ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
Ruby runtime = recv.getRuntime();
args[0] = Helpers.invoke(context, runtime.getFile(), "open", args[0], runtime.newString("rb"));
JZlibRubyGzipReader gzio = newInstance(recv, args);
return RubyGzipFile.wrapBlock(context, gzio, block);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "open", required = 1, optional = 1, meta = true, compat = RUBY1_9)
public static IRubyObject open19(final ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
Ruby runtime = recv.getRuntime();
args[0] = Helpers.invoke(context, runtime.getFile(), "open", args[0], runtime.newString("rb"));
JZlibRubyGzipReader gzio = newInstance(recv, args, block);
return RubyGzipFile.wrapBlock(context, gzio, block);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(name = "open", required = 1, optional = 3, meta = true)
public static IRubyObject open19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
Ruby runtime = recv.getRuntime();
args[0] = Helpers.invoke(context, runtime.getFile(), "open", args[0], runtime.newString("wb"));
JZlibRubyGzipWriter gzio = newInstance(recv, args);
return RubyGzipFile.wrapBlock(context, gzio, block);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "open", required = 1, optional = 2, meta = true, compat = RUBY1_8)
public static IRubyObject open18(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
Ruby runtime = recv.getRuntime();
args[0] = Helpers.invoke(context, runtime.getFile(), "open", args[0], runtime.newString("wb"));
JZlibRubyGzipWriter gzio = newInstance(recv, args, block);
return RubyGzipFile.wrapBlock(context, gzio, block);
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "open", required = 1, optional = 3, meta = true)
public static IRubyObject open19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
Ruby runtime = recv.getRuntime();
args[0] = Helpers.invoke(context, runtime.getFile(), "open", args[0], runtime.newString("wb"));
JZlibRubyGzipWriter gzio = newInstance(recv, args);
return RubyGzipFile.wrapBlock(context, gzio, block);
}
代码示例来源:origin: org.jruby/jruby-complete
public static RubyClass createFileStatClass(Ruby runtime) {
// TODO: NOT_ALLOCATABLE_ALLOCATOR is probably ok here. Confirm. JRUBY-415
final RubyClass fileStatClass = runtime.getFile().defineClassUnder("Stat",runtime.getObject(), ALLOCATOR);
runtime.setFileStat(fileStatClass);
fileStatClass.includeModule(runtime.getModule("Comparable"));
fileStatClass.defineAnnotatedMethods(RubyFileStat.class);
return fileStatClass;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod
public IRubyObject sub_ext(ThreadContext context, IRubyObject newExt) {
IRubyObject ext = context.runtime.getFile().callMethod(context, "extname", getPath());
IRubyObject newPath = getPath().chomp(context, ext).callMethod(context, "+", newExt);
return newInstance(context, newPath);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod
public IRubyObject sub_ext(ThreadContext context, IRubyObject newExt) {
IRubyObject ext = context.runtime.getFile().callMethod(context, "extname", getPath());
IRubyObject newPath = getPath().chomp(context, ext).callMethod(context, "+", newExt);
return newInstance(context, newPath);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = {"unlink", "delete"})
public IRubyObject unlink(ThreadContext context) {
try {
return context.runtime.getDir().callMethod(context, "unlink", path);
} catch (RaiseException ex) {
if (!context.runtime.getErrno().getClass("ENOTDIR").isInstance(ex.getException())) {
throw ex;
}
return context.runtime.getFile().callMethod(context, "unlink", path);
}
}
内容来源于网络,如有侵权,请联系作者删除!