Examples of FileTime


Examples of java.nio.file.attribute.FileTime

        }
      }

      BasicFileAttributes basic_attr = Files.readAttributes(path, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
      final Long filesize = basic_attr.size();
      final FileTime creationTime = basic_attr.creationTime();
      final FileTime modifyTime = basic_attr.lastModifiedTime();
      final FileTime accessTime = basic_attr.lastAccessTime();

      if (basic_attr.isDirectory()) {
        type = ItemType.FOLDER;
      } else if (basic_attr.isRegularFile()) {
        type = ItemType.FILE;
View Full Code Here

Examples of java.nio.file.attribute.FileTime

        return FileSystems.getDefault().getPath(FS.separators(path));
    }

    public static void touch(Path path) throws IOException
    {
        FileTime now = FileTime.fromMillis(System.currentTimeMillis());
        Files.setLastModifiedTime(path,now);
    }
View Full Code Here

Examples of java.nio.file.attribute.FileTime

    @Override
    public long lastModified()
    {
        try
        {
            FileTime ft = Files.getLastModifiedTime(path,NO_FOLLOW_LINKS);
            return ft.toMillis();
        }
        catch (IOException e)
        {
            LOG.ignore(e);
            return 0;
View Full Code Here

Examples of java.nio.file.attribute.FileTime

        @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
            if (exc == null) {
                log("--> postVisitDirectory dir: " + dir);
                Path dir_created = target.resolve(source.relativize(dir));
                try {
                    FileTime time = Files.getLastModifiedTime(dir);
                    Files.setLastModifiedTime(dir_created, time);
                } catch (IOException x) {
                    System.err.format("ERROR in postVisitDirectory: Unable to copy all attributes to: %s: %s%n", dir_created, x);
                }
            }
View Full Code Here

Examples of java.nio.file.attribute.FileTime

        @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
            if (exc == null) {
                log("--> postVisitDirectory dir: " + dir);
                Path dir_created = target.resolve(source.relativize(dir));
                try {
                    FileTime time = Files.getLastModifiedTime(dir);
                    Files.setLastModifiedTime(dir_created, time);
                } catch (IOException x) {
                    System.err.format("ERROR in postVisitDirectory: Unable to copy all attributes to: %s: %s%n", dir_created, x);
                }
            }
View Full Code Here

Examples of java.nio.file.attribute.FileTime

    private boolean isUpToDate() {
        try {
            Path extractedFile = appCache.resolve(".extracted");
            if (!Files.exists(extractedFile))
                return false;
            FileTime extractedTime = Files.getLastModifiedTime(extractedFile);

            Path jarFile = Paths.get(jar.getName());
            FileTime jarTime = Files.getLastModifiedTime(jarFile);

            return extractedTime.compareTo(jarTime) >= 0;
        } catch (IOException e) {
            throw new AssertionError(e);
        }
View Full Code Here

Examples of java.nio.file.attribute.FileTime

        @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
            if (exc == null) {
                log("--> postVisitDirectory dir: " + dir);
                Path dir_created = target.resolve(source.relativize(dir));
                try {
                    FileTime time = Files.getLastModifiedTime(dir);
                    Files.setLastModifiedTime(dir_created, time);
                } catch (IOException x) {
                    System.err.format("ERROR in postVisitDirectory: Unable to copy all attributes to: %s: %s%n", dir_created, x);
                }
            }
View Full Code Here

Examples of java.nio.file.attribute.FileTime

            return false;
        try {
            Path extractedFile = appCache.resolve(TIMESTAMP_FILE_NAME);
            if (!Files.exists(extractedFile))
                return false;
            FileTime extractedTime = Files.getLastModifiedTime(extractedFile);
            FileTime jarTime = Files.getLastModifiedTime(jarFile);
            return extractedTime.compareTo(jarTime) >= 0;
        } catch (IOException e) {
            throw new AssertionError(e);
        }
    }
View Full Code Here

Examples of java.nio.file.attribute.FileTime

    @JRubyMethod(name = "birthtime")
    public IRubyObject birthtime(ThreadContext context) {
        checkClosed(context);

        FileTime btime = getBirthtimeWithNIO(getPath());
        if (btime != null) return context.runtime.newTime(btime.toMillis()); // btime comes in nanos
        return ctime(context);
    }
View Full Code Here

Examples of java.nio.file.attribute.FileTime

        return getRuntime().newTime(stat.ctime() * 1000);
    }

    @JRubyMethod(name = "birthtime")
    public IRubyObject birthtime() {
        FileTime btime = RubyFile.getBirthtimeWithNIO(file.absolutePath());
        if (btime != null) return getRuntime().newTime(btime.toMillis());
        return ctime();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.