Test.java Source code

Java tutorial

Introduction

Here is the source code for Test.java

Source

import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.DosFileAttributeView;
import java.nio.file.attribute.DosFileAttributes;

public class Test {

    public static void main(String[] args) throws Exception {
        Path path = FileSystems.getDefault().getPath("/home/docs/users.txt");
        DosFileAttributeView view = Files.getFileAttributeView(path, DosFileAttributeView.class);
        DosFileAttributes attributes = view.readAttributes();

        System.out.println("isArchive: " + attributes.isArchive());
        System.out.println("isHidden: " + attributes.isHidden());
        System.out.println("isReadOnly: " + attributes.isReadOnly());
        System.out.println("isSystem: " + attributes.isSystem());
    }
}