Package java.nio.file.attribute

Examples of java.nio.file.attribute.BasicFileAttributes.fileKey()


        if (depth >= maxDepth || !attrs.isDirectory()) {
            return new Event(EventType.ENTRY, entry, attrs);
        }

        // check for cycles when following links
        if (followLinks && wouldLoop(entry, attrs.fileKey())) {
            return new Event(EventType.ENTRY, entry,
                             new FileSystemLoopException(entry.toString()));
        }

        // file is a directory, attempt to open it
View Full Code Here


                return null;
            throw se;
        }

        // push a directory node to the stack and return an event
        stack.push(new DirectoryNode(entry, attrs.fileKey(), stream));
        return new Event(EventType.START_DIRECTORY, entry, attrs);
    }


    /**
 
View Full Code Here

    System.out.printf(">>> Directory? %s\n", basicAttributes.isDirectory());
    System.out.printf(">>> File? %s\n", basicAttributes.isRegularFile());
    System.out.printf(">>> Last accessed on: %s\n", basicAttributes.lastAccessTime());
    System.out.printf(">>> Last modified on: %s\n", basicAttributes.lastModifiedTime());
    System.out.printf(">>> File size (bytes): %s\n", basicAttributes.size());
    System.out.printf(">>> File key : %s\n", basicAttributes.fileKey());
    File tempDir = new File(System.getProperty("java.io.tmpdir"));
    Path tempDirPathRef = Paths.get(tempDir.toURI());
    Path p = null;
    Iterator<Path> tmpIter = null;
    System.out.printf("Files in directory '%s'\n", tempDir.getName());
View Full Code Here

  public void testReadAttributes_asObject() {
    File file = Directory.create(0);
    service.setInitialAttributes(file);

    BasicFileAttributes basicAttrs = service.readAttributes(file, BasicFileAttributes.class);
    assertThat(basicAttrs.fileKey()).isEqualTo(0);
    assertThat(basicAttrs.isDirectory()).isTrue();
    assertThat(basicAttrs.isRegularFile()).isFalse();

    TestAttributes testAttrs = service.readAttributes(file, TestAttributes.class);
    assertThat(testAttrs.foo()).isEqualTo("hello");
View Full Code Here

    assertThat(view).isNotNull();
    assertThat(view.name()).isEqualTo("basic");

    BasicFileAttributes attrs = view.readAttributes();
    assertThat(attrs.fileKey()).isEqualTo(0);

    FileTime time = attrs.creationTime();
    assertThat(attrs.lastAccessTime()).isEqualTo(time);
    assertThat(attrs.lastModifiedTime()).isEqualTo(time);
View Full Code Here

  }

  @Test
  public void testAttributes() {
    BasicFileAttributes attrs = provider.readAttributes(file);
    assertThat(attrs.fileKey()).isEqualTo(0);
    assertThat(attrs.isDirectory()).isTrue();
    assertThat(attrs.isRegularFile()).isFalse();
    assertThat(attrs.creationTime()).isNotNull();
  }
}
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.