本文整理了Java中jnr.posix.POSIX.mkdir()
方法的一些代码示例,展示了POSIX.mkdir()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。POSIX.mkdir()
方法的具体详情如下:
包路径:jnr.posix.POSIX
类名称:POSIX
方法名:mkdir
暂无
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
public int mkdir(String path, int mode) {
try { return posix.mkdir(path, mode); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
public int mkdir(String path, int mode) {
return posix().mkdir(path, mode);
}
代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep
public int mkdir(String path, int mode) {
try { return posix.mkdir(path, mode); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
public int mkdir(String path, int mode) {
return posix().mkdir(path, mode);
}
代码示例来源:origin: com.github.jnr/jnr-posix
public int mkdir(String path, int mode) {
try { return posix.mkdir(path, mode); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep
public int mkdir(String path, int mode) {
return posix().mkdir(path, mode);
}
代码示例来源:origin: com.github.jnr/jnr-posix
public int mkdir(String path, int mode) {
return posix().mkdir(path, mode);
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
public int mkdir(String path, int mode) {
try { return posix.mkdir(path, mode); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private static IRubyObject mkdirCommon(Ruby runtime, String path, IRubyObject[] args) {
File newDir = getDir(runtime, path, false);
String name = path.replace('\\', '/');
boolean startsWithDriveLetterOnWindows = RubyFile.startsWithDriveLetterOnWindows(name);
// don't attempt to create a dir for drive letters
if (startsWithDriveLetterOnWindows) {
// path is just drive letter plus :
if (path.length() == 2) return RubyFixnum.zero(runtime);
// path is drive letter plus : plus leading or trailing /
if (path.length() == 3 && (path.charAt(0) == '/' || path.charAt(2) == '/')) return RubyFixnum.zero(runtime);
// path is drive letter plus : plus leading and trailing /
if (path.length() == 4 && (path.charAt(0) == '/' && path.charAt(3) == '/')) return RubyFixnum.zero(runtime);
}
if (File.separatorChar == '\\') newDir = new File(newDir.getPath());
int mode = args.length == 2 ? ((int) args[1].convertToInteger().getLongValue()) : 0777;
if (runtime.getPosix().mkdir(newDir.getAbsolutePath(), mode) < 0) {
// FIXME: This is a system error based on errno
throw runtime.newSystemCallError("mkdir failed");
}
return RubyFixnum.zero(runtime);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private static IRubyObject mkdirCommon(Ruby runtime, String path, IRubyObject[] args) {
File newDir = getDir(runtime, path, false);
String name = path.replace('\\', '/');
boolean startsWithDriveLetterOnWindows = RubyFile.startsWithDriveLetterOnWindows(name);
// don't attempt to create a dir for drive letters
if (startsWithDriveLetterOnWindows) {
// path is just drive letter plus :
if (path.length() == 2) return RubyFixnum.zero(runtime);
// path is drive letter plus : plus leading or trailing /
if (path.length() == 3 && (path.charAt(0) == '/' || path.charAt(2) == '/')) return RubyFixnum.zero(runtime);
// path is drive letter plus : plus leading and trailing /
if (path.length() == 4 && (path.charAt(0) == '/' && path.charAt(3) == '/')) return RubyFixnum.zero(runtime);
}
if (File.separatorChar == '\\') newDir = new File(newDir.getPath());
int mode = args.length == 2 ? ((int) args[1].convertToInteger().getLongValue()) : 0777;
if (runtime.getPosix().mkdir(newDir.getAbsolutePath(), mode) < 0) {
// FIXME: This is a system error based on errno
throw runtime.newSystemCallError("mkdir failed");
}
return RubyFixnum.zero(runtime);
}
代码示例来源:origin: org.jruby/jruby-core
private static IRubyObject mkdirCommon(Ruby runtime, String path, IRubyObject[] args) {
if (path.startsWith("uri:")) throw runtime.newErrnoEACCESError(path);
path = dirFromPath(path, runtime);
FileResource res = JRubyFile.createResource(runtime, path);
if (res.isDirectory()) throw runtime.newErrnoEEXISTError(path);
String name = path.replace('\\', '/');
boolean startsWithDriveLetterOnWindows = RubyFile.startsWithDriveLetterOnWindows(name);
// don't attempt to create a dir for drive letters
if (startsWithDriveLetterOnWindows) {
// path is just drive letter plus :
if (path.length() == 2) return RubyFixnum.zero(runtime);
// path is drive letter plus : plus leading or trailing /
if (path.length() == 3 && (path.charAt(0) == '/' || path.charAt(2) == '/')) return RubyFixnum.zero(runtime);
// path is drive letter plus : plus leading and trailing /
if (path.length() == 4 && (path.charAt(0) == '/' && path.charAt(3) == '/')) return RubyFixnum.zero(runtime);
}
File newDir = res.unwrap(File.class);
if (File.separatorChar == '\\') newDir = new File(newDir.getPath());
int mode = args.length == 2 ? ((int) args[1].convertToInteger().getLongValue()) : 0777;
if (runtime.getPosix().mkdir(newDir.getAbsolutePath(), mode) < 0) {
// FIXME: This is a system error based on errno
throw runtime.newSystemCallError("mkdir failed");
}
return RubyFixnum.zero(runtime);
}
代码示例来源:origin: org.jruby/jruby-complete
private static IRubyObject mkdirCommon(Ruby runtime, String path, IRubyObject[] args) {
if (path.startsWith("uri:")) throw runtime.newErrnoEACCESError(path);
path = dirFromPath(path, runtime);
FileResource res = JRubyFile.createResource(runtime, path);
if (res.isDirectory()) throw runtime.newErrnoEEXISTError(path);
String name = path.replace('\\', '/');
boolean startsWithDriveLetterOnWindows = RubyFile.startsWithDriveLetterOnWindows(name);
// don't attempt to create a dir for drive letters
if (startsWithDriveLetterOnWindows) {
// path is just drive letter plus :
if (path.length() == 2) return RubyFixnum.zero(runtime);
// path is drive letter plus : plus leading or trailing /
if (path.length() == 3 && (path.charAt(0) == '/' || path.charAt(2) == '/')) return RubyFixnum.zero(runtime);
// path is drive letter plus : plus leading and trailing /
if (path.length() == 4 && (path.charAt(0) == '/' && path.charAt(3) == '/')) return RubyFixnum.zero(runtime);
}
File newDir = res.unwrap(File.class);
if (File.separatorChar == '\\') newDir = new File(newDir.getPath());
int mode = args.length == 2 ? ((int) args[1].convertToInteger().getLongValue()) : 0777;
if (runtime.getPosix().mkdir(newDir.getAbsolutePath(), mode) < 0) {
// FIXME: This is a system error based on errno
throw runtime.newSystemCallError("mkdir failed");
}
return RubyFixnum.zero(runtime);
}
代码示例来源:origin: org.python/jython
public static void mkdir(PyObject path, int mode) {
if (os == OS.NT) {
try {
Path nioPath = absolutePath(path);
// Windows does not use any mode attributes in creating a directory;
// see the corresponding function in posixmodule.c, posix_mkdir;
Files.createDirectory(nioPath);
} catch (FileAlreadyExistsException ex) {
throw Py.OSError(Errno.EEXIST, path);
} catch (IOException ioe) {
throw Py.OSError(ioe);
} catch (SecurityException ex) {
throw Py.OSError(Errno.EACCES, path);
}
// Further work on mapping mode to PosixAttributes would have to be done
// for non Windows platforms. In addition, posix.mkdir would still be necessary
// for mode bits like stat.S_ISGID
} else if (posix.mkdir(absolutePath(path).toString(), mode) < 0) {
throw errorFromErrno(path);
}
}
内容来源于网络,如有侵权,请联系作者删除!