Page 1 of 1

About Question enthuware.ocpjp.v7.2.1523 :

Posted: Fri Oct 09, 2015 3:56 am
by kemosabe
I was scanning the javadocs, and haven't been able to find a comprehensive list of all valid attributes (e.g. "dos:hidden") for use in java.nio.file.Files.setAttribute. Are they listed somewhere, or do you just have to remember them based on the operating system you are using?

Re: About Question enthuware.ocpjp.v7.2.1523 :

Posted: Fri Oct 09, 2015 4:08 am
by admin
You need to refer to BasicFileAttributeView, DosFileAttributeView, and PosixFileAttributeView

http://docs.oracle.com/javase/7/docs/ap ... eView.html

Re: About Question enthuware.ocpjp.v7.2.1523 :

Posted: Sun Oct 18, 2015 11:19 am
by kemosabe
That helps, thanks. For anyone else, I discovered that while the attributes are listed in the respective XAttributesView javadoc, the name (e.g. "dos:" prefix) is defined by the name() function of those classes.

e.g.
DosFileAttributeView dosAttributesView = Files.getFileAttributeView(p, DosFileAttributeView.class);
System.out.println("DosFileAttributes view name is "+ dosAttributesView.name());