本文整理了Java中org.jruby.Ruby.newErrnoFromInt
方法的一些代码示例,展示了Ruby.newErrnoFromInt
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newErrnoFromInt
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newErrnoFromInt
暂无
代码示例来源:origin: org.jruby/jruby-complete
public RaiseException newErrnoFromInt(int errno, String methodName, String message) {
if (Platform.IS_WINDOWS && ("stat".equals(methodName) || "lstat".equals(methodName))) {
if (errno == 20047) return newErrnoENOENTError(message); // boo:bar UNC stat failure
if (errno == Errno.ESRCH.intValue()) return newErrnoENOENTError(message); // ESRCH on stating ""
}
return newErrnoFromInt(errno, message);
}
代码示例来源:origin: org.jruby/jruby-complete
public RaiseException newErrnoFromErrno(Errno errno, String message) {
if (errno == null || errno == Errno.__UNKNOWN_CONSTANT__) {
return newSystemCallError(message);
}
return newErrnoFromInt(errno.intValue(), message);
}
代码示例来源:origin: org.jruby/jruby-core
public RaiseException newErrnoFromInt(int errno, String methodName, String message) {
if (Platform.IS_WINDOWS && ("stat".equals(methodName) || "lstat".equals(methodName))) {
if (errno == 20047) return newErrnoENOENTError(message); // boo:bar UNC stat failure
if (errno == Errno.ESRCH.intValue()) return newErrnoENOENTError(message); // ESRCH on stating ""
}
return newErrnoFromInt(errno, message);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public RaiseException newErrnoFromInt(int errno, String methodName, String message) {
if (Platform.IS_WINDOWS && ("stat".equals(methodName) || "lstat".equals(methodName))) {
if (errno == 20047) return newErrnoENOENTError(message); // boo:bar UNC stat failure
if (errno == Errno.ESRCH.intValue()) return newErrnoENOENTError(message); // ESRCH on stating ""
}
return newErrnoFromInt(errno, message);
}
代码示例来源:origin: org.jruby/jruby-core
private void setup(String filename, boolean lstat) {
Ruby runtime = getRuntime();
if (Platform.IS_WINDOWS && filename.length() == 2
&& filename.charAt(1) == ':' && Character.isLetter(filename.charAt(0))) {
filename += '/';
}
file = JRubyFile.createResource(runtime, filename);
stat = lstat ? file.lstat() : file.stat();
if (stat == null) throw runtime.newErrnoFromInt(file.errno(), filename);
}
代码示例来源:origin: org.jruby/jruby-complete
private void setup(String filename, boolean lstat) {
Ruby runtime = getRuntime();
if (Platform.IS_WINDOWS && filename.length() == 2
&& filename.charAt(1) == ':' && Character.isLetter(filename.charAt(0))) {
filename += '/';
}
file = JRubyFile.createResource(runtime, filename);
stat = lstat ? file.lstat() : file.stat();
if (stat == null) throw runtime.newErrnoFromInt(file.errno(), filename);
}
代码示例来源:origin: org.jruby/jruby-complete
public RaiseException newErrnoFromInt(int errno) {
Errno errnoObj = Errno.valueOf(errno);
if (errnoObj == null) {
return newSystemCallError("Unknown Error (" + errno + ")");
}
String message = errnoObj.description();
return newErrnoFromInt(errno, message);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public RaiseException newErrnoFromInt(int errno) {
Errno errnoObj = Errno.valueOf(errno);
if (errnoObj == null) {
return newSystemCallError("Unknown Error (" + errno + ")");
}
String message = errnoObj.description();
return newErrnoFromInt(errno, message);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public RaiseException newErrnoFromInt(int errno) {
Errno errnoObj = Errno.valueOf(errno);
if (errnoObj == null) {
return newSystemCallError("Unknown Error (" + errno + ")");
}
String message = errnoObj.description();
return newErrnoFromInt(errno, message);
}
代码示例来源:origin: org.jruby/jruby-core
public RaiseException newErrnoFromInt(int errno) {
Errno errnoObj = Errno.valueOf(errno);
if (errnoObj == null) {
return newSystemCallError("Unknown Error (" + errno + ")");
}
String message = errnoObj.description();
return newErrnoFromInt(errno, message);
}
代码示例来源:origin: org.jruby/jruby-complete
private static void raiseErrnoIfSet(Ruby runtime, NonNativeErrno nonNative) {
if (runtime.getPosix().errno() != 0) {
throw runtime.newErrnoFromInt(runtime.getPosix().errno());
}
}
代码示例来源:origin: org.jruby/jruby-core
protected static void rb_sys_fail(Ruby runtime, String message) {
final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime());
RubyClass instance = runtime.getErrno(n);
if(instance == null) {
throw runtime.newSystemCallError(message);
} else {
throw runtime.newErrnoFromInt(n, message);
}
}
代码示例来源:origin: org.jruby/jruby-complete
protected static void rb_sys_fail(Ruby runtime, String message) {
final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime());
RubyClass instance = runtime.getErrno(n);
if(instance == null) {
throw runtime.newSystemCallError(message);
} else {
throw runtime.newErrnoFromInt(n, message);
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
protected static void rb_sys_fail(Ruby runtime, String message) {
final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime());
RubyClass instance = runtime.getErrno(n);
if(instance == null) {
throw runtime.newSystemCallError(message);
} else {
throw runtime.newErrnoFromInt(n, message);
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private static void raiseErrnoIfSet(Ruby runtime, NonNativeErrno nonNative) {
if (runtime.getPosix().errno() != 0) {
throw runtime.newErrnoFromInt(runtime.getPosix().errno());
}
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private static void raiseErrnoIfSet(Ruby runtime, NonNativeErrno nonNative) {
if (runtime.getPosix().errno() != 0) {
throw runtime.newErrnoFromInt(runtime.getPosix().errno());
}
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
protected static void rb_sys_fail(Ruby runtime, String message) {
final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime());
RubyClass instance = runtime.getErrno(n);
if(instance == null) {
throw runtime.newSystemCallError(message);
} else {
throw runtime.newErrnoFromInt(n, message);
}
}
代码示例来源:origin: org.jruby/jruby-complete
public static IRubyObject mkfifo(ThreadContext context, RubyString path, int mode) {
Ruby runtime = context.runtime;
String decodedPath = JRubyFile.createResource(runtime, path.toString()).absolutePath();
if (runtime.getPosix().mkfifo(decodedPath, mode) != 0) {
throw runtime.newErrnoFromInt(runtime.getPosix().errno(), decodedPath);
}
return RubyFixnum.zero(runtime);
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "setrlimit", module = true, visibility = PRIVATE)
public static IRubyObject setrlimit(ThreadContext context, IRubyObject recv, IRubyObject resource, IRubyObject rlimCur, IRubyObject rlimMax) {
Ruby runtime = context.runtime;
RLimit rlim = runtime.getPosix().getrlimit(0);
if (rlimMax == context.nil)
rlimMax = rlimCur;
rlim.init(rlimitResourceValue(runtime, rlimCur), rlimitResourceValue(runtime, rlimMax));
if (runtime.getPosix().setrlimit(rlimitResourceType(runtime, resource), rlim) < 0) {
throw runtime.newErrnoFromInt(runtime.getPosix().errno(), "setrlimit");
}
return context.nil;
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(name = "setrlimit", module = true, visibility = PRIVATE)
public static IRubyObject setrlimit(ThreadContext context, IRubyObject recv, IRubyObject resource, IRubyObject rlimCur, IRubyObject rlimMax) {
Ruby runtime = context.runtime;
RLimit rlim = runtime.getPosix().getrlimit(0);
if (rlimMax == context.nil)
rlimMax = rlimCur;
rlim.init(rlimitResourceValue(runtime, rlimCur), rlimitResourceValue(runtime, rlimMax));
if (runtime.getPosix().setrlimit(rlimitResourceType(runtime, resource), rlim) < 0) {
throw runtime.newErrnoFromInt(runtime.getPosix().errno(), "setrlimit");
}
return context.nil;
}
内容来源于网络,如有侵权,请联系作者删除!