jnr.posix.POSIX.unlink()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(168)

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

POSIX.unlink介绍

暂无

代码示例

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

  1. public int unlink(CharSequence path) {
  2. return posix().unlink(path);
  3. }

代码示例来源:origin: com.github.jnr/jnr-posix

  1. public int unlink(CharSequence path) {
  2. try { return posix.unlink(path); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
  3. }

代码示例来源:origin: com.github.jnr/jnr-posix

  1. public int unlink(CharSequence path) {
  2. return posix().unlink(path);
  3. }

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

  1. public int unlink(CharSequence path) {
  2. try { return posix.unlink(path); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
  3. }

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

  1. public int unlink(CharSequence path) {
  2. try { return posix.unlink(path); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
  3. }

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

  1. public int unlink(CharSequence path) {
  2. return posix().unlink(path);
  3. }

代码示例来源:origin: jerlang/jerlang

  1. /**
  2. * http://www.erlang.org/doc/man/file.html#delete-1
  3. */
  4. public static Term delete_1(Str filename) {
  5. int result = posix.unlink(filename.string());
  6. switch (result) {
  7. case 0:
  8. return ok;
  9. default:
  10. return Tuple.of(error, Integer.of(result));
  11. }
  12. }

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

  1. @JRubyMethod(rest = true, meta = true)
  2. public static IRubyObject unlink(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  3. Ruby runtime = context.runtime;
  4. POSIX posix = runtime.getPosix();
  5. if (!posix.isNative() || Platform.IS_WINDOWS) return delete(context, recv, args);
  6. for (int i = 0; i < args.length; i++) {
  7. RubyString filename = StringSupport.checkEmbeddedNulls(runtime, get_path(context, args[i]));
  8. JRubyFile lToDelete = JRubyFile.create(runtime.getCurrentDirectory(), filename.getUnicodeValue());
  9. boolean isSymlink = RubyFileTest.symlink_p(recv, filename).isTrue();
  10. // Broken symlinks considered by exists() as non-existing,
  11. // so we need to check for symlinks explicitly.
  12. if (!lToDelete.exists() && !isSymlink) {
  13. throw runtime.newErrnoENOENTError(filename.getUnicodeValue());
  14. }
  15. if (lToDelete.isDirectory() && !isSymlink) {
  16. throw runtime.newErrnoEPERMError(filename.getUnicodeValue());
  17. }
  18. if (posix.unlink(lToDelete.getAbsolutePath()) < 0) {
  19. throw runtime.newErrnoFromInt(posix.errno());
  20. }
  21. }
  22. return runtime.newFixnum(args.length);
  23. }

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

  1. @JRubyMethod(rest = true, meta = true)
  2. public static IRubyObject unlink(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  3. Ruby runtime = context.runtime;
  4. POSIX posix = runtime.getPosix();
  5. if (!posix.isNative() || Platform.IS_WINDOWS) return delete(context, recv, args);
  6. for (int i = 0; i < args.length; i++) {
  7. RubyString filename = StringSupport.checkEmbeddedNulls(runtime, get_path(context, args[i]));
  8. JRubyFile lToDelete = JRubyFile.create(runtime.getCurrentDirectory(), filename.getUnicodeValue());
  9. boolean isSymlink = RubyFileTest.symlink_p(recv, filename).isTrue();
  10. // Broken symlinks considered by exists() as non-existing,
  11. // so we need to check for symlinks explicitly.
  12. if (!lToDelete.exists() && !isSymlink) {
  13. throw runtime.newErrnoENOENTError(filename.getUnicodeValue());
  14. }
  15. if (lToDelete.isDirectory() && !isSymlink) {
  16. throw runtime.newErrnoEPERMError(filename.getUnicodeValue());
  17. }
  18. if (posix.unlink(lToDelete.getAbsolutePath()) < 0) {
  19. throw runtime.newErrnoFromInt(posix.errno());
  20. }
  21. }
  22. return runtime.newFixnum(args.length);
  23. }

相关文章

POSIX类方法