Java IO Tutorial - Java

Syntax has the following syntax.

GroupPrincipal group()


In the following code shows how to use method.

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFileAttributeView;
import java.nio.file.attribute.PosixFileAttributes;
/*from   ww  w . j av a 2s . c  om*/
public class Main {

  public static void main(String[] args) throws Exception {

    Path path = Paths.get("c:/home/tutorial/Java/JavaFX/Topic.txt");

    PosixFileAttributes attr = Files.readAttributes(path,PosixFileAttributes.class);
    attr = Files.getFileAttributeView(path, PosixFileAttributeView.class)

    System.out.println("File owner: " + attr.owner().getName());
    System.out.println("File group: " +;
    System.out.println("File permissions: " + attr.permissions().toString());