Java IO Tutorial - Java Files.isHidden(Path path)








Syntax

Files.isHidden(Path path) has the following syntax.

public static boolean isHidden(Path path)   throws IOException

Example

In the following code shows how to use Files.isHidden(Path path) method.

/*from  w w  w  . j  a  v  a2 s  .  co m*/

import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {

    public static void main(String[] args) {

        Path path = FileSystems.getDefault().getPath("C:/tutorial/Java/JavaFX", "Demo.txt");

        //is hidden ?
        try {
            boolean is_hidden = Files.isHidden(path);
            System.out.println("Is hidden ? " + is_hidden);
        } catch (IOException e) {
            System.err.println(e);
        }
    }
}