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

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

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

POSIX.mkdir介绍

暂无

代码示例

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

  1. public int mkdir(String path, int mode) {
  2. try { return posix.mkdir(path, mode); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
  3. }

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

  1. public int mkdir(String path, int mode) {
  2. return posix().mkdir(path, mode);
  3. }

代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep

  1. public int mkdir(String path, int mode) {
  2. try { return posix.mkdir(path, mode); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
  3. }

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

  1. public int mkdir(String path, int mode) {
  2. return posix().mkdir(path, mode);
  3. }

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

  1. public int mkdir(String path, int mode) {
  2. try { return posix.mkdir(path, mode); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
  3. }

代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep

  1. public int mkdir(String path, int mode) {
  2. return posix().mkdir(path, mode);
  3. }

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

  1. public int mkdir(String path, int mode) {
  2. return posix().mkdir(path, mode);
  3. }

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

  1. public int mkdir(String path, int mode) {
  2. try { return posix.mkdir(path, mode); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
  3. }

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

  1. private static IRubyObject mkdirCommon(Ruby runtime, String path, IRubyObject[] args) {
  2. File newDir = getDir(runtime, path, false);
  3. String name = path.replace('\\', '/');
  4. boolean startsWithDriveLetterOnWindows = RubyFile.startsWithDriveLetterOnWindows(name);
  5. // don't attempt to create a dir for drive letters
  6. if (startsWithDriveLetterOnWindows) {
  7. // path is just drive letter plus :
  8. if (path.length() == 2) return RubyFixnum.zero(runtime);
  9. // path is drive letter plus : plus leading or trailing /
  10. if (path.length() == 3 && (path.charAt(0) == '/' || path.charAt(2) == '/')) return RubyFixnum.zero(runtime);
  11. // path is drive letter plus : plus leading and trailing /
  12. if (path.length() == 4 && (path.charAt(0) == '/' && path.charAt(3) == '/')) return RubyFixnum.zero(runtime);
  13. }
  14. if (File.separatorChar == '\\') newDir = new File(newDir.getPath());
  15. int mode = args.length == 2 ? ((int) args[1].convertToInteger().getLongValue()) : 0777;
  16. if (runtime.getPosix().mkdir(newDir.getAbsolutePath(), mode) < 0) {
  17. // FIXME: This is a system error based on errno
  18. throw runtime.newSystemCallError("mkdir failed");
  19. }
  20. return RubyFixnum.zero(runtime);
  21. }

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

  1. private static IRubyObject mkdirCommon(Ruby runtime, String path, IRubyObject[] args) {
  2. File newDir = getDir(runtime, path, false);
  3. String name = path.replace('\\', '/');
  4. boolean startsWithDriveLetterOnWindows = RubyFile.startsWithDriveLetterOnWindows(name);
  5. // don't attempt to create a dir for drive letters
  6. if (startsWithDriveLetterOnWindows) {
  7. // path is just drive letter plus :
  8. if (path.length() == 2) return RubyFixnum.zero(runtime);
  9. // path is drive letter plus : plus leading or trailing /
  10. if (path.length() == 3 && (path.charAt(0) == '/' || path.charAt(2) == '/')) return RubyFixnum.zero(runtime);
  11. // path is drive letter plus : plus leading and trailing /
  12. if (path.length() == 4 && (path.charAt(0) == '/' && path.charAt(3) == '/')) return RubyFixnum.zero(runtime);
  13. }
  14. if (File.separatorChar == '\\') newDir = new File(newDir.getPath());
  15. int mode = args.length == 2 ? ((int) args[1].convertToInteger().getLongValue()) : 0777;
  16. if (runtime.getPosix().mkdir(newDir.getAbsolutePath(), mode) < 0) {
  17. // FIXME: This is a system error based on errno
  18. throw runtime.newSystemCallError("mkdir failed");
  19. }
  20. return RubyFixnum.zero(runtime);
  21. }

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

  1. private static IRubyObject mkdirCommon(Ruby runtime, String path, IRubyObject[] args) {
  2. if (path.startsWith("uri:")) throw runtime.newErrnoEACCESError(path);
  3. path = dirFromPath(path, runtime);
  4. FileResource res = JRubyFile.createResource(runtime, path);
  5. if (res.isDirectory()) throw runtime.newErrnoEEXISTError(path);
  6. String name = path.replace('\\', '/');
  7. boolean startsWithDriveLetterOnWindows = RubyFile.startsWithDriveLetterOnWindows(name);
  8. // don't attempt to create a dir for drive letters
  9. if (startsWithDriveLetterOnWindows) {
  10. // path is just drive letter plus :
  11. if (path.length() == 2) return RubyFixnum.zero(runtime);
  12. // path is drive letter plus : plus leading or trailing /
  13. if (path.length() == 3 && (path.charAt(0) == '/' || path.charAt(2) == '/')) return RubyFixnum.zero(runtime);
  14. // path is drive letter plus : plus leading and trailing /
  15. if (path.length() == 4 && (path.charAt(0) == '/' && path.charAt(3) == '/')) return RubyFixnum.zero(runtime);
  16. }
  17. File newDir = res.unwrap(File.class);
  18. if (File.separatorChar == '\\') newDir = new File(newDir.getPath());
  19. int mode = args.length == 2 ? ((int) args[1].convertToInteger().getLongValue()) : 0777;
  20. if (runtime.getPosix().mkdir(newDir.getAbsolutePath(), mode) < 0) {
  21. // FIXME: This is a system error based on errno
  22. throw runtime.newSystemCallError("mkdir failed");
  23. }
  24. return RubyFixnum.zero(runtime);
  25. }

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

  1. private static IRubyObject mkdirCommon(Ruby runtime, String path, IRubyObject[] args) {
  2. if (path.startsWith("uri:")) throw runtime.newErrnoEACCESError(path);
  3. path = dirFromPath(path, runtime);
  4. FileResource res = JRubyFile.createResource(runtime, path);
  5. if (res.isDirectory()) throw runtime.newErrnoEEXISTError(path);
  6. String name = path.replace('\\', '/');
  7. boolean startsWithDriveLetterOnWindows = RubyFile.startsWithDriveLetterOnWindows(name);
  8. // don't attempt to create a dir for drive letters
  9. if (startsWithDriveLetterOnWindows) {
  10. // path is just drive letter plus :
  11. if (path.length() == 2) return RubyFixnum.zero(runtime);
  12. // path is drive letter plus : plus leading or trailing /
  13. if (path.length() == 3 && (path.charAt(0) == '/' || path.charAt(2) == '/')) return RubyFixnum.zero(runtime);
  14. // path is drive letter plus : plus leading and trailing /
  15. if (path.length() == 4 && (path.charAt(0) == '/' && path.charAt(3) == '/')) return RubyFixnum.zero(runtime);
  16. }
  17. File newDir = res.unwrap(File.class);
  18. if (File.separatorChar == '\\') newDir = new File(newDir.getPath());
  19. int mode = args.length == 2 ? ((int) args[1].convertToInteger().getLongValue()) : 0777;
  20. if (runtime.getPosix().mkdir(newDir.getAbsolutePath(), mode) < 0) {
  21. // FIXME: This is a system error based on errno
  22. throw runtime.newSystemCallError("mkdir failed");
  23. }
  24. return RubyFixnum.zero(runtime);
  25. }

代码示例来源:origin: org.python/jython

  1. public static void mkdir(PyObject path, int mode) {
  2. if (os == OS.NT) {
  3. try {
  4. Path nioPath = absolutePath(path);
  5. // Windows does not use any mode attributes in creating a directory;
  6. // see the corresponding function in posixmodule.c, posix_mkdir;
  7. Files.createDirectory(nioPath);
  8. } catch (FileAlreadyExistsException ex) {
  9. throw Py.OSError(Errno.EEXIST, path);
  10. } catch (IOException ioe) {
  11. throw Py.OSError(ioe);
  12. } catch (SecurityException ex) {
  13. throw Py.OSError(Errno.EACCES, path);
  14. }
  15. // Further work on mapping mode to PosixAttributes would have to be done
  16. // for non Windows platforms. In addition, posix.mkdir would still be necessary
  17. // for mode bits like stat.S_ISGID
  18. } else if (posix.mkdir(absolutePath(path).toString(), mode) < 0) {
  19. throw errorFromErrno(path);
  20. }
  21. }

相关文章

POSIX类方法