DevFaqFileAttributes

What are File Attributes?

FileObjects have attributes. These are ad-hoc key-value pairs which can be associated with a file and persist across shutdown and restart.

Attributes are routinely used in the module XML files which define the initial contents of the system filesystem. They are used to providing additional configuration data for files, such as declaring sorting order or the path to an icon file.

Attributes are perfectly safe to use freely in layer.xml files.

In pre-4.0 NetBeans, they were relatively commonly used for user files on disk. They still may be used for user files, but this is now discouraged - the infrastructure has been changed to store all attributes in the userdir rather than sprinking .nbattrs files in directories all over the user's disk. Since they are now stored in a central location, the more attributes there are, the longer it takes to find attributes for any given file. Using attributes for user files on disk has negative performance implications.

See FileObject.getAttribute and FileObject.setAttribute.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo