Example usage for java.nio.file.attribute DosFileAttributeView setHidden

List of usage examples for java.nio.file.attribute DosFileAttributeView setHidden

Introduction

In this page you can find the example usage for java.nio.file.attribute DosFileAttributeView setHidden.

Prototype

void setHidden(boolean value) throws IOException;

Source Link

Document

Updates the value of the hidden attribute.

Usage

From source file:Test.java

public static void main(String[] args) throws Exception {
    Path path = FileSystems.getDefault().getPath("./file2.log");
    System.out.println("File Size:" + Files.size(path));
    System.out.println("Is Directory:" + Files.isDirectory(path));
    System.out.println("Is Regular File:" + Files.isRegularFile(path));
    System.out.println("Is Symbolic Link:" + Files.isSymbolicLink(path));
    System.out.println("Is Hidden:" + Files.isHidden(path));
    System.out.println("Last Modified Time:" + Files.getLastModifiedTime(path));
    System.out.println("Owner:" + Files.getOwner(path));

    DosFileAttributeView view = Files.getFileAttributeView(path, DosFileAttributeView.class);
    System.out.println("Archive  :" + view.readAttributes().isArchive());
    System.out.println("Hidden   :" + view.readAttributes().isHidden());
    System.out.println("Read-only:" + view.readAttributes().isReadOnly());
    System.out.println("System   :" + view.readAttributes().isSystem());

    view.setHidden(false);
}