getting known keys from an AttributeView
Alan Bateman
Alan.Bateman at Sun.COM
Wed Jan 27 06:04:03 PST 2010
Joel Uckelman wrote:
> :
> If you have a way to get the attrib names programatically, then
> Path.readAttributes() only needs contain code for parsing the attribute
> string, and can be basically the same across all Path implementations.
> Without it, you end up having to list out all of the possible attributes,
> which means that you're now maintaining this list in multiple places.
> (For example, the names from BasicFileAttributeView will be repeated in
> every readAttributes() implementation.) This is error-prone
>
For now, we don't have any base classes for provider implementers. It is
something we could examine in the future once there is more experience
developing custom providers. BasicFileAttributeView is required to be
supported by all providers so a case could be made to define a base
implementation class in the spi package that concrete providers could
extend. That base class could implement set/get/readAttributes, which I
think it what you are suggesting. In our default provider we have
sun.nio.fs.AbstractBasicFileAttribtueView for this purpose but that
isn't useful to other providers.
-Alan.
More information about the nio-dev
mailing list