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

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

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

Ruby.newSystemCallError介绍

暂无

代码示例

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

public static IRubyObject rb_sys_fail_path(Ruby runtime, String path) {
  throw runtime.newSystemCallError("bad path for cloexec: " + path);
}

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

public static IRubyObject rb_sys_fail_path(Ruby runtime, String path) {
  throw runtime.newSystemCallError("bad path for cloexec: " + path);
}

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

public RaiseException newErrnoFromInt(int errno, String message) {
  RubyClass errnoClass = getErrno(errno);
  if (errnoClass != null) {
    return newRaiseException(errnoClass, message);
  } else {
    return newSystemCallError("Unknown Error (" + 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 message) {
  RubyClass errnoClass = getErrno(errno);
  if (errnoClass != null) {
    return newRaiseException(errnoClass, message);
  } else {
    return newSystemCallError("Unknown Error (" + errno + ") - " + message);
  }
}

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

public RaiseException newErrnoFromErrno(Errno errno, String message) {
  if (errno == null || errno == Errno.__UNKNOWN_CONSTANT__) {
    return newSystemCallError(message);
  }
  return newErrnoFromInt(errno.intValue(), message);
}

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

public RaiseException newErrnoFromInt(int errno, String message) {
  RubyClass errnoClass = getErrno(errno);
  if (errnoClass != null) {
    return newRaiseException(errnoClass, message);
  } else {
    return newSystemCallError("Unknown Error (" + errno + ") - " + message);
  }
}

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

public RaiseException newErrnoFromInt(int errno, String message) {
  RubyClass errnoClass = getErrno(errno);
  if (errnoClass != null) {
    return newRaiseException(errnoClass, message);
  } else {
    return newSystemCallError("Unknown Error (" + errno + ") - " + message);
  }
}

代码示例来源: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

protected static ChannelFD sysopen(Ruby runtime, String fname, int oflags, int perm) {
  ChannelFD fd;
  Sysopen data = new Sysopen();
  data.fname = fname;
  data.oflags = oflags;
  data.perm = perm;
  fd = sysopenInternal(runtime, data);
  if (fd == null) {
    if (data.errno != null) {
      throw runtime.newErrnoFromErrno(data.errno, fname);
    } else {
      throw runtime.newSystemCallError(fname);
    }
  }
  return fd;
}

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

protected static ChannelFD sysopen(Ruby runtime, String fname, int oflags, int perm) {
  ChannelFD fd;
  Sysopen data = new Sysopen();
  data.fname = fname;
  data.oflags = oflags;
  data.perm = perm;
  fd = sysopenInternal(runtime, data);
  if (fd == null) {
    if (data.errno != null) {
      throw runtime.newErrnoFromErrno(data.errno, fname);
    } else {
      throw runtime.newSystemCallError(fname);
    }
  }
  return fd;
}

代码示例来源: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: 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: 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: 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

@JRubyMethod
public RubyFixnum fsync(ThreadContext context) {
  Ruby runtime = context.runtime;
  OpenFile fptr;
  RubyIO io = GetWriteIO();
  fptr = io.getOpenFileChecked();
  if (fptr.io_fflush(context) < 0)
    throw runtime.newSystemCallError("");
  if (!Platform.IS_WINDOWS) { /* already called in io_fflush() */
    try {
      if (fptr.fileChannel() != null) fptr.fileChannel().force(true);
      if (fptr.fd().chNative != null) {
        int ret = runtime.getPosix().fsync(fptr.fd().chNative.getFD());
        if (ret < 0) throw runtime.newErrnoFromInt(runtime.getPosix().errno());
      }
    } catch (IOException ioe) {
      throw runtime.newIOErrorFromException(ioe);
    }
  }
  return RubyFixnum.zero(runtime);
}

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

@JRubyMethod
public RubyFixnum fsync(ThreadContext context) {
  Ruby runtime = context.runtime;
  OpenFile fptr;
  RubyIO io = GetWriteIO();
  fptr = io.getOpenFileChecked();
  if (fptr.io_fflush(context) < 0)
    throw runtime.newSystemCallError("");
  if (!Platform.IS_WINDOWS) { /* already called in io_fflush() */
    try {
      if (fptr.fileChannel() != null) fptr.fileChannel().force(true);
      if (fptr.fd().chNative != null) {
        int ret = runtime.getPosix().fsync(fptr.fd().chNative.getFD());
        if (ret < 0) throw runtime.newErrnoFromInt(runtime.getPosix().errno());
      }
    } catch (IOException ioe) {
      throw runtime.newIOErrorFromException(ioe);
    }
  }
  return RubyFixnum.zero(runtime);
}

相关文章

Ruby类方法