Package java.nio.file.attribute

Examples of java.nio.file.attribute.FileTime


            return mode;
        }

        private Object makeDate(Context cx, Object o)
        {
            FileTime ft = (FileTime)o;
            return cx.newObject(this, "Date", new Object[] { ft.toMillis() });
        }
View Full Code Here


        String fname = args[2];
        Descriptor descriptor = Descriptor.fromFilename(fname);
        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

            return false;
        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

            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

        ImmutableMap.of(
            "foo", "hello",
            "bar", 0L,
            "baz", 1));

    FileTime time = (FileTime) service.getAttribute(file, "basic:creationTime");

    map = service.readAttributes(file, "test:*");
    assertThat(map).isEqualTo(
        ImmutableMap.<String, Object>builder()
            .put("foo", "hello")
View Full Code Here

    private BasicFileAttributes attrs() throws IOException {
      return Files.readAttributes(path, BasicFileAttributes.class);
    }

    public void assertAccessTimeChanged() throws IOException {
      FileTime t = attrs().lastAccessTime();
      assertThat(t).isNotEqualTo(accessTime);
      accessTime = t;
    }
View Full Code Here

      assertThat(t).isNotEqualTo(accessTime);
      accessTime = t;
    }

    public void assertAccessTimeDidNotChange() throws IOException {
      FileTime t = attrs().lastAccessTime();
      assertThat(t).isEqualTo(accessTime);
    }
View Full Code Here

      FileTime t = attrs().lastAccessTime();
      assertThat(t).isEqualTo(accessTime);
    }

    public void assertModifiedTimeChanged() throws IOException {
      FileTime t = attrs().lastModifiedTime();
      assertThat(t).isNotEqualTo(modifiedTime);
      modifiedTime = t;
    }
View Full Code Here

      assertThat(t).isNotEqualTo(modifiedTime);
      modifiedTime = t;
    }

    public void assertModifiedTimeDidNotChange() throws IOException {
      FileTime t = attrs().lastModifiedTime();
      assertThat(t).isEqualTo(modifiedTime);
    }
View Full Code Here

            .build());
  }

  @Test
  public void testSet() {
    FileTime time = FileTime.fromMillis(0L);

    // settable
    assertSetAndGetSucceeds("creationTime", time);
    assertSetAndGetSucceeds("lastModifiedTime", time);
    assertSetAndGetSucceeds("lastAccessTime", time);
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.