Package java.nio.file.attribute

Examples of java.nio.file.attribute.PosixFileAttributes.group()


        {
            this.groupName = groupName;
        }
        else
        {
            this.groupName = posixFileAttributes.group().getName();
            groupCache.put( gid, this.groupName );
        }

        setLsModeParts( PosixFilePermissions.toString( posixFileAttributes.permissions() ).toCharArray() );
    }
View Full Code Here


      PosixFileAttributeView posixView = Files.getFileAttributeView(path, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
      if (posixView != null) {
        final PosixFileAttributes attr = posixView.readAttributes();
        if (type.equals(ItemType.LINK)) {
          attributes.put(Item.ATTRIBUTE_POSIX, new String[] { attr.group().getName(), attr.owner().getName() });
        } else {
          attributes.put(Item.ATTRIBUTE_POSIX, new String[] { attr.group().getName(), attr.owner().getName(), fromPermissions(attr.permissions()).toString() });
        }
      } else {
View Full Code Here

      if (posixView != null) {
        final PosixFileAttributes attr = posixView.readAttributes();
        if (type.equals(ItemType.LINK)) {
          attributes.put(Item.ATTRIBUTE_POSIX, new String[] { attr.group().getName(), attr.owner().getName() });
        } else {
          attributes.put(Item.ATTRIBUTE_POSIX, new String[] { attr.group().getName(), attr.owner().getName(), fromPermissions(attr.permissions()).toString() });
        }
      } else {

        DosFileAttributeView dosView = Files.getFileAttributeView(path, DosFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
        if (dosView != null) {
View Full Code Here

    assertThat(view.getOwner()).isEqualTo(createUserPrincipal("user"));

    PosixFileAttributes attrs = view.readAttributes();
    assertThat(attrs.fileKey()).isEqualTo(0);
    assertThat(attrs.owner()).isEqualTo(createUserPrincipal("user"));
    assertThat(attrs.group()).isEqualTo(createGroupPrincipal("group"));
    assertThat(attrs.permissions()).isEqualTo(PosixFilePermissions.fromString("rw-r--r--"));

    view.setOwner(createUserPrincipal("root"));
    assertThat(view.getOwner()).isEqualTo(createUserPrincipal("root"));
    assertThat(file.getAttribute("owner", "owner")).isEqualTo(createUserPrincipal("root"));
View Full Code Here

  @Test
  public void testAttributes() {
    PosixFileAttributes attrs = provider.readAttributes(file);
    assertThat(attrs.permissions()).isEqualTo(PosixFilePermissions.fromString("rw-r--r--"));
    assertThat(attrs.group()).isEqualTo(createGroupPrincipal("group"));
    assertThat(attrs.fileKey()).isEqualTo(0);
  }
}
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.