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

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

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

POSIX.lutimes介绍

暂无

代码示例

代码示例来源:origin: stephenh/mirror

  1. @VisibleForTesting
  2. public static void setModifiedTimeForSymlink(Path absolutePath, long millis) throws IOException {
  3. long[] modTime = millisToTimeStructArray(millis);
  4. int r = posix.lutimes(absolutePath.toString(), modTime, modTime);
  5. if (r != 0) {
  6. throw new IOException("lutimes failed with code " + r);
  7. }
  8. }

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

  1. public int lutimes(String path, long[] atimeval, long[] mtimeval) {
  2. try { return posix.lutimes(path, atimeval, mtimeval); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
  3. }

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

  1. public int lutimes(String path, long[] atimeval, long[] mtimeval) {
  2. return posix().lutimes(path, atimeval, mtimeval);
  3. }

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

  1. @JRubyMethod(required = 2, rest = true, meta = true)
  2. public static IRubyObject lutime(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  3. Ruby runtime = context.runtime;
  4. long[] atimeval = null;
  5. long[] mtimeval = null;
  6. if (args[0] != context.nil || args[1] != context.nil) {
  7. atimeval = extractTimespec(context, args[0]);
  8. mtimeval = extractTimespec(context, args[1]);
  9. }
  10. for (int i = 2, j = args.length; i < j; i++) {
  11. RubyString filename = StringSupport.checkEmbeddedNulls(runtime, get_path(context, args[i]));
  12. JRubyFile fileToTouch = JRubyFile.create(runtime.getCurrentDirectory(), filename.getUnicodeValue());
  13. if (!fileToTouch.exists()) {
  14. throw runtime.newErrnoENOENTError(filename.toString());
  15. }
  16. int result = runtime.getPosix().lutimes(fileToTouch.getAbsolutePath(), atimeval, mtimeval);
  17. if (result == -1) {
  18. throw runtime.newErrnoFromInt(runtime.getPosix().errno());
  19. }
  20. }
  21. return runtime.newFixnum(args.length - 2);
  22. }

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

  1. @JRubyMethod(required = 2, rest = true, meta = true)
  2. public static IRubyObject lutime(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
  3. Ruby runtime = context.runtime;
  4. long[] atimeval = null;
  5. long[] mtimeval = null;
  6. if (args[0] != context.nil || args[1] != context.nil) {
  7. atimeval = extractTimespec(context, args[0]);
  8. mtimeval = extractTimespec(context, args[1]);
  9. }
  10. for (int i = 2, j = args.length; i < j; i++) {
  11. RubyString filename = StringSupport.checkEmbeddedNulls(runtime, get_path(context, args[i]));
  12. JRubyFile fileToTouch = JRubyFile.create(runtime.getCurrentDirectory(), filename.getUnicodeValue());
  13. if (!fileToTouch.exists()) {
  14. throw runtime.newErrnoENOENTError(filename.toString());
  15. }
  16. int result = runtime.getPosix().lutimes(fileToTouch.getAbsolutePath(), atimeval, mtimeval);
  17. if (result == -1) {
  18. throw runtime.newErrnoFromInt(runtime.getPosix().errno());
  19. }
  20. }
  21. return runtime.newFixnum(args.length - 2);
  22. }

相关文章

POSIX类方法