Package java.nio.file.attribute

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


        @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

    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

        @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

            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

    @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

        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

        assertThat(FileUtils.readFileToByteArray(daemonJar.toFile()), is(expectedContent));
    }

    @Test
    public void does_not_copy_the_daemon_JAR_if_it_has_already_been_copied() throws IOException {
        FileTime lastModified1 = Files.getLastModifiedTime(steward.getDaemonJar(jumiHome));
        FileTime lastModified2 = Files.getLastModifiedTime(steward.getDaemonJar(jumiHome));

        assertThat(lastModified2, is(lastModified1));
    }
View Full Code Here

            Descriptor descriptor = Descriptor.fromFilename(fname);
            if (descriptor.version.hasRepairedAt())
            {
                if (setIsRepaired)
                {
                    FileTime f = Files.getLastModifiedTime(new File(descriptor.filenameFor(Component.DATA)).toPath());
                    descriptor.getMetadataSerializer().mutateRepairedAt(descriptor, f.toMillis());
                }
                else
                {
                    descriptor.getMetadataSerializer().mutateRepairedAt(descriptor, ActiveRepairService.UNREPAIRED_SSTABLE);
                }
View Full Code Here

                    attrView = Files.getFileAttributeView(path, BasicFileAttributeView.class);
                }

                BasicFileAttributes attrs = attrView.readAttributes();
                // The timestamp seems to come from JavaScript as a decimal value of seconds
                FileTime newATime = FileTime.fromMillis((long)(atime * 1000.0));
                FileTime newMTime = FileTime.fromMillis((long)(mtime * 1000.0));
                attrView.setTimes(newMTime, newATime, attrs.creationTime());
            } catch (IOException ioe) {
                throw new NodeOSException(getErrorCode(ioe), ioe, path.toString());
            }
            return new Object[] { Context.getUndefinedValue(), Context.getUndefinedValue() };
View Full Code Here

TOP

Related Classes of java.nio.file.attribute.FileTime

Copyright © 2018 www.massapicom. 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.