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

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

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

Ruby.newErrnoEISDirError介绍

暂无

代码示例

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

public RaiseException newErrnoEISDirError() {
  return newErrnoEISDirError("Is a directory");
}

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

public RaiseException newErrnoEISDirError() {
  return newErrnoEISDirError("Is a directory");
}

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

public RaiseException newErrnoEISDirError() {
  return newErrnoEISDirError("Is a directory");
}

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

public RaiseException newErrnoEISDirError() {
  return newErrnoEISDirError("Is a directory");
}

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

public static void failIfDirectory(Ruby runtime, RubyString pathStr) {
  if (RubyFileTest.directory_p(runtime, pathStr).isTrue()) {
    if (Platform.IS_WINDOWS) {
      throw runtime.newErrnoEACCESError(pathStr.asJavaString());
    } else {
      throw runtime.newErrnoEISDirError(pathStr.asJavaString());
    }
  }
}

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

public static void failIfDirectory(Ruby runtime, RubyString pathStr) {
  if (RubyFileTest.directory_p(runtime, pathStr).isTrue()) {
    if (Platform.IS_WINDOWS) {
      throw runtime.newErrnoEACCESError(pathStr.asJavaString());
    } else {
      throw runtime.newErrnoEISDirError(pathStr.asJavaString());
    }
  }
}

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

public static void failIfDirectory(Ruby runtime, RubyString pathStr) {
  if (RubyFileTest.directory_p(runtime, pathStr).isTrue()) {
    if (Platform.IS_WINDOWS) {
      throw runtime.newErrnoEACCESError(pathStr.asJavaString());
    } else {
      throw runtime.newErrnoEISDirError(pathStr.asJavaString());
    }
  }
}

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

public static void failIfDirectory(Ruby runtime, RubyString pathStr) {
  if (RubyFileTest.directory_p(runtime, pathStr).isTrue()) {
    if (Platform.IS_WINDOWS) {
      throw runtime.newErrnoEACCESError(pathStr.asJavaString());
    } else {
      throw runtime.newErrnoEISDirError(pathStr.asJavaString());
    }
  }
}

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

throw runtime.newErrnoEISDirError(path);

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

throw runtime.newErrnoEISDirError(path);

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

throw getRuntime().newErrnoEISDirError();
} catch (FileExistsException ex) {
  throw getRuntime().newErrnoEEXISTError(path);

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

throw getRuntime().newErrnoEISDirError();
} catch (FileExistsException ex) {
  throw getRuntime().newErrnoEEXISTError(path);

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

throw runtime.newErrnoENOENTError(path);
} catch (DirectoryAsFileException dafe) {
  throw runtime.newErrnoEISDirError(path);
} catch (FileExistsException fee) {
  throw runtime.newErrnoEEXISTError(path);

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

private ChannelDescriptor sysopen(String path, ModeFlags modes, int perm) {
  try {
    ChannelDescriptor descriptor = ChannelDescriptor.open(
        getRuntime().getCurrentDirectory(),
        path,
        modes,
        perm,
        getRuntime().getPosix(),
        getRuntime().getJRubyClassLoader());
    // TODO: check if too many open files, GC and try again
    return descriptor;
  } catch (PermissionDeniedException pde) {
    // PDException can be thrown only when creating the file and
    // permission is denied.  See JavaDoc of PermissionDeniedException.
    throw getRuntime().newErrnoEACCESError(path);
  } catch (FileNotFoundException fnfe) {
    // FNFException can be thrown in both cases, when the file
    // is not found, or when permission is denied.
    if (Ruby.isSecurityRestricted() || new File(path).exists()) {
      throw getRuntime().newErrnoEACCESError(path);
    }
    throw getRuntime().newErrnoENOENTError(path);
  } catch (DirectoryAsFileException dafe) {
    throw getRuntime().newErrnoEISDirError();
  } catch (FileExistsException fee) {
    throw getRuntime().newErrnoEEXISTError(path);
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}

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

private ChannelDescriptor sysopen(String path, ModeFlags modes, int perm) {
  try {
    ChannelDescriptor descriptor = ChannelDescriptor.open(
        getRuntime().getCurrentDirectory(),
        path,
        modes,
        perm,
        getRuntime().getPosix(),
        getRuntime().getJRubyClassLoader());
    // TODO: check if too many open files, GC and try again
    return descriptor;
  } catch (PermissionDeniedException pde) {
    // PDException can be thrown only when creating the file and
    // permission is denied.  See JavaDoc of PermissionDeniedException.
    throw getRuntime().newErrnoEACCESError(path);
  } catch (FileNotFoundException fnfe) {
    // FNFException can be thrown in both cases, when the file
    // is not found, or when permission is denied.
    if (Ruby.isSecurityRestricted() || new File(path).exists()) {
      throw getRuntime().newErrnoEACCESError(path);
    }
    throw getRuntime().newErrnoENOENTError(path);
  } catch (DirectoryAsFileException dafe) {
    throw getRuntime().newErrnoEISDirError();
  } catch (FileExistsException fee) {
    throw getRuntime().newErrnoEEXISTError(path);
  } catch (IOException ioe) {
    throw getRuntime().newIOErrorFromException(ioe);
  }
}

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

throw runtime.newErrnoENOENTError(path);
} catch (DirectoryAsFileException dafe) {
  throw runtime.newErrnoEISDirError(path);
} catch (FileExistsException fee) {
  throw runtime.newErrnoEEXISTError(path);

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

@JRubyMethod(rest = true, meta = true)
public static IRubyObject delete(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  Ruby runtime = context.runtime;
  for (int i = 0; i < args.length; i++) {
    RubyString filename = StringSupport.checkEmbeddedNulls(runtime, get_path(context, args[i]));
    JRubyFile file = JRubyFile.create(runtime.getCurrentDirectory(), filename.getUnicodeValue());
    // Broken symlinks considered by exists() as non-existing,
    // so we need to check for symlinks explicitly.
    if (!file.exists() && !isSymlink(context, file)) {
      throw runtime.newErrnoENOENTError(filename.getUnicodeValue());
    }
    if (file.isDirectory() && !isSymlink(context, file)) {
      throw runtime.newErrnoEISDirError(filename.getUnicodeValue());
    }
    if (!file.delete()) {
      throw runtime.newErrnoEACCESError(filename.getUnicodeValue());
    }
  }
  return runtime.newFixnum(args.length);
}

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

@JRubyMethod(rest = true, meta = true)
public static IRubyObject delete(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  Ruby runtime = context.runtime;
  for (int i = 0; i < args.length; i++) {
    RubyString filename = StringSupport.checkEmbeddedNulls(runtime, get_path(context, args[i]));
    JRubyFile file = JRubyFile.create(runtime.getCurrentDirectory(), filename.getUnicodeValue());
    // Broken symlinks considered by exists() as non-existing,
    // so we need to check for symlinks explicitly.
    if (!file.exists() && !isSymlink(context, file)) {
      throw runtime.newErrnoENOENTError(filename.getUnicodeValue());
    }
    if (file.isDirectory() && !isSymlink(context, file)) {
      throw runtime.newErrnoEISDirError(filename.getUnicodeValue());
    }
    if (!file.delete()) {
      throw runtime.newErrnoEACCESError(filename.getUnicodeValue());
    }
  }
  return runtime.newFixnum(args.length);
}

相关文章

Ruby类方法