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

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

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

Ruby.newErrnoENOENTError介绍

暂无

代码示例

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

private void verifyExecutable() {
  if (executableFile == null) {
    if (executable == null) {
      executable = args[0].trim();
    }
    executableFile = findPathExecutable(runtime, executable);
  }
  if (executableFile == null) {
    throw runtime.newErrnoENOENTError(executable);
  }
}

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

private void verifyExecutable() {
  if (executableFile == null) {
    if (executable == null) {
      executable = args[0].trim();
    }
    executableFile = findPathExecutable(runtime, executable);
  }
  if (executableFile == null) {
    throw runtime.newErrnoENOENTError(executable);
  }
}

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

private void verifyExecutable() {
  if (executableFile == null) {
    if (executable == null) {
      executable = args[0].trim();
    }
    executableFile = findPathExecutable(runtime, executable);
  }
  if (executableFile == null) {
    throw runtime.newErrnoENOENTError(executable);
  }
}

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

private void verifyExecutable() {
  if (executableFile == null) {
    if (executable == null) {
      executable = args[0].trim();
    }
    executableFile = findPathExecutable(runtime, executable);
  }
  if (executableFile == null) {
    throw runtime.newErrnoENOENTError(executable);
  }
}

代码示例来源:origin: com.ning.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 static void noFileError(IRubyObject filename) {
    throw filename.getRuntime().newErrnoENOENTError("No such file or directory - " +
        filename.convertToString());
  }
}

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

private static void noFileError(IRubyObject filename) {
    throw filename.getRuntime().newErrnoENOENTError("No such file or directory - " +
        filename.convertToString());
  }
}

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

private static void noFileError(IRubyObject filename) {
    throw filename.getRuntime().newErrnoENOENTError("No such file or directory - " +
        filename.convertToString());
  }
}

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

private static List<String> getEntries(Ruby runtime, String path) {
  if (!RubyFileTest.directory_p(runtime, RubyString.newString(runtime, path)).isTrue()) {
    throw runtime.newErrnoENOENTError("No such directory: " + path);
  }
  if (path.startsWith("jar:")) path = path.substring(4);
  if (path.startsWith("file:")) return entriesIntoAJarFile(runtime, path);
  return entriesIntoADirectory(runtime, path);
}

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

public static IRubyObject realpath(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  RubyString file = expandPathInternal(context, args, false, true);
  if (!RubyFileTest.exist(context, file)) {
    throw context.runtime.newErrnoENOENTError(file.toString());
  }
  return file;
}

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

private static FileResource getExistingDir(final Ruby runtime, final String path) {
  FileResource result = JRubyFile.createResource(runtime, path);
  if (result == null || !result.exists()) {
    throw runtime.newErrnoENOENTError(path);
  }
  if (!result.isDirectory()) {
    throw runtime.newErrnoENOTDIRError(path);
  }
  return result;
}

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

@JRubyMethod(required = 1)
public IRubyObject chmod(ThreadContext context, IRubyObject arg) {
  checkClosed(context);
  int mode = (int) arg.convertToInteger().getLongValue();
  if (!new File(path).exists()) {
    throw context.runtime.newErrnoENOENTError(path);
  }
  return context.runtime.newFixnum(context.runtime.getPosix().chmod(path, mode));
}

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

@JRubyMethod(required = 1)
public IRubyObject chmod(ThreadContext context, IRubyObject arg) {
  checkClosed(context);
  int mode = (int) arg.convertToInteger().getLongValue();
  final String path = getPath();
  if ( ! new File(path).exists() ) {
    throw context.runtime.newErrnoENOENTError(path);
  }
  return context.runtime.newFixnum(context.runtime.getPosix().chmod(path, mode));
}

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

@JRubyMethod(required = 1)
public IRubyObject chmod(ThreadContext context, IRubyObject arg) {
  checkClosed(context);
  int mode = (int) arg.convertToInteger().getLongValue();
  final String path = getPath();
  if ( ! new File(path).exists() ) {
    throw context.runtime.newErrnoENOENTError(path);
  }
  return context.runtime.newFixnum(context.runtime.getPosix().chmod(path, mode));
}

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

private static String[] getEntries(ThreadContext context, FileResource dir, String path) {
  if (!dir.isDirectory()) {
    if (dir.exists()) {
      throw context.runtime.newErrnoENOTDIRError(path);
    }
    throw context.runtime.newErrnoENOENTError(path);
  }
  if (!dir.canRead()) throw context.runtime.newErrnoEACCESError(path);
  String[] list = dir.list();
  return list == null ? NO_FILES : list;
}

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

@JRubyMethod(meta = true)
public static IRubyObject realpath(ThreadContext context, IRubyObject recv, IRubyObject path) {
  RubyString file;
  file = StringSupport.checkEmbeddedNulls(context.runtime, get_path(context, path));
  file = expandPathInternal(context, file, null, false, true);
  if (!RubyFileTest.exist(context, file)) {
    throw context.runtime.newErrnoENOENTError(file.toString());
  }
  return file;
}

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

private static String[] getEntries(ThreadContext context, FileResource dir, String path) {
  if (!dir.isDirectory()) {
    if (dir.exists()) {
      throw context.runtime.newErrnoENOTDIRError(path);
    }
    throw context.runtime.newErrnoENOENTError(path);
  }
  if (!dir.canRead()) throw context.runtime.newErrnoEACCESError(path);
  String[] list = dir.list();
  return list == null ? NO_FILES : list;
}

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

@JRubyMethod(meta = true)
public static IRubyObject realpath(ThreadContext context, IRubyObject recv, IRubyObject path, IRubyObject cwd) {
  RubyString file;
  file = StringSupport.checkEmbeddedNulls(context.runtime, get_path(context, path));
  RubyString wd = StringSupport.checkEmbeddedNulls(context.runtime, get_path(context, cwd));
  file = expandPathInternal(context, file, wd, false, true);
  if (!RubyFileTest.exist(context, file)) {
    throw context.runtime.newErrnoENOENTError(file.toString());
  }
  return file;
}

相关文章

微信公众号

最新文章

更多

Ruby类方法