本文整理了Java中jnr.posix.POSIX.unlink()
方法的一些代码示例,展示了POSIX.unlink()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。POSIX.unlink()
方法的具体详情如下:
包路径:jnr.posix.POSIX
类名称:POSIX
方法名:unlink
暂无
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
public int unlink(CharSequence path) {
return posix().unlink(path);
}
代码示例来源:origin: com.github.jnr/jnr-posix
public int unlink(CharSequence path) {
try { return posix.unlink(path); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: com.github.jnr/jnr-posix
public int unlink(CharSequence path) {
return posix().unlink(path);
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
public int unlink(CharSequence path) {
try { return posix.unlink(path); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
public int unlink(CharSequence path) {
try { return posix.unlink(path); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
public int unlink(CharSequence path) {
return posix().unlink(path);
}
代码示例来源:origin: jerlang/jerlang
/**
* http://www.erlang.org/doc/man/file.html#delete-1
*/
public static Term delete_1(Str filename) {
int result = posix.unlink(filename.string());
switch (result) {
case 0:
return ok;
default:
return Tuple.of(error, Integer.of(result));
}
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(rest = true, meta = true)
public static IRubyObject unlink(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
Ruby runtime = context.runtime;
POSIX posix = runtime.getPosix();
if (!posix.isNative() || Platform.IS_WINDOWS) return delete(context, recv, args);
for (int i = 0; i < args.length; i++) {
RubyString filename = StringSupport.checkEmbeddedNulls(runtime, get_path(context, args[i]));
JRubyFile lToDelete = JRubyFile.create(runtime.getCurrentDirectory(), filename.getUnicodeValue());
boolean isSymlink = RubyFileTest.symlink_p(recv, filename).isTrue();
// Broken symlinks considered by exists() as non-existing,
// so we need to check for symlinks explicitly.
if (!lToDelete.exists() && !isSymlink) {
throw runtime.newErrnoENOENTError(filename.getUnicodeValue());
}
if (lToDelete.isDirectory() && !isSymlink) {
throw runtime.newErrnoEPERMError(filename.getUnicodeValue());
}
if (posix.unlink(lToDelete.getAbsolutePath()) < 0) {
throw runtime.newErrnoFromInt(posix.errno());
}
}
return runtime.newFixnum(args.length);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(rest = true, meta = true)
public static IRubyObject unlink(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
Ruby runtime = context.runtime;
POSIX posix = runtime.getPosix();
if (!posix.isNative() || Platform.IS_WINDOWS) return delete(context, recv, args);
for (int i = 0; i < args.length; i++) {
RubyString filename = StringSupport.checkEmbeddedNulls(runtime, get_path(context, args[i]));
JRubyFile lToDelete = JRubyFile.create(runtime.getCurrentDirectory(), filename.getUnicodeValue());
boolean isSymlink = RubyFileTest.symlink_p(recv, filename).isTrue();
// Broken symlinks considered by exists() as non-existing,
// so we need to check for symlinks explicitly.
if (!lToDelete.exists() && !isSymlink) {
throw runtime.newErrnoENOENTError(filename.getUnicodeValue());
}
if (lToDelete.isDirectory() && !isSymlink) {
throw runtime.newErrnoEPERMError(filename.getUnicodeValue());
}
if (posix.unlink(lToDelete.getAbsolutePath()) < 0) {
throw runtime.newErrnoFromInt(posix.errno());
}
}
return runtime.newFixnum(args.length);
}
内容来源于网络,如有侵权,请联系作者删除!