Eliminate ByteBuffers
Elliotte Harold
elharo at metalab.unc.edu
Mon Oct 6 08:15:02 PDT 2008
Alan Bateman wrote:
> I suspect we have a mis-understanding here. The NamedAttributeView
> provides a view of a file's "named attributes" which are typically used
> to store meta data that is not meaningful to the file system -- ie: this
> is not your usual file size, time stamps, file permissions, etc. This is
> application defined meta-data that can only be treated as binary blobs
> by the file system and API. The blobs are named and the read/write
> methods are used for transferring the bits (hence the buffers). The
> terminology varies by operating system and file system but think
> extended attributes or named streams. In our implementation it maps to
> NTFS Alternative Data Streams, ext3 extended attributes, or zfs extended
> attributes. In the samples directory you will find the Xdd sample that
> may be useful to try.
>
I do understand, but I still don't think ByteBuffers have any business
in this API. I do not believe client programmers want to transfer binary
blobs of metadata using ByteBuffers. I am not convinced these are quite
the opaque blobs you prefer; but if opaque blobs they must be, then they
should be byte arrays, not byte buffers.
> As regards the javadoc you cited - the FileAttributeViews provide for
> both typesafe and "dynamic access" to the attributes that they support.
> For dynamic access, which I think is what you are looking for, you use
> the Attributes class and the getAttribute/setAttribute/readAttributes
> methods to read or update the attributes you require. The readAttributes
> methods returns a map of the requested attributes.
>
Methods that always return null (getAttribute), or an empty Map
(readAttributes) and methods that take only a subset of the declared
argument type (setAttribute), indicate a failure of inheritance and
polymorphism. The design simply doesn't work. The subinterface is
violating the contract of the superinterface. NIO.2 needs to either make
these methods work, or reorganize the inheritance hierarchy so that
NamedAttributeView does not extend AttributeView.
--
Elliotte Rusty Harold elharo at metalab.unc.edu
Refactoring HTML Just Published!
http://www.amazon.com/exec/obidos/ISBN=0321503635/ref=nosim/cafeaulaitA
More information about the nio-discuss
mailing list