Java examples for File Path IO:DOS File
Maintaining FAT table attributes using the DosFileAttributeView
import java.io.IOException; 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 Main { public static void main(String[] args) { Path path = FileSystems.getDefault().getPath("/home/docs/users.txt"); try {// w ww . j ava2 s. c om 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()); } catch (IOException ex) { ex.printStackTrace(); } } }