elharo at metalab.unc.edu
Mon Oct 6 06:43:39 PDT 2008
Well, not everywhere. :-) However I do wonder about the use of
ByteBuffers in what amount to maps such as NamedAttributeView.
int write(String name, ByteBuffer src) throws IOException
Why not just simple getAttribute and setAttribute methods? We have them but
Object getAttribute(String attribute)
Reads the value of an attribute.
In this release, this method may not be used to read the value of a
named attribute. Consequently this method will return null.
NamedAttributeView setAttribute(String attribute,
Writes the value of an named attribute from a buffer.
The value parameter is a ByteBuffer and this method writes the
value of the attribute from the buffer as if by invoking the write method.
This is so weird I'm not sure where to start. The object passed to
setAttribute is always a ByteBuffer, but it's declared as an Object?
Why? getAttribute always returns null?
This is improving, but it's still very strange and hard to follow.
I think named attributes need to be reduced to a simple String name and
an Object or String (probably Object) value. ByteBuffers simply should
not be in the picture here. I guess you have ByteBuffers on the brain
because of all the other work you're doing with them, but they're not a
common or comfortable API for this sort of work. Nor are they necessary.
I think if you treat the NamedAttributeView as a map, it will be much
simpler, cleaner, and more effective.
Elliotte Rusty Harold elharo at metalab.unc.edu
Refactoring HTML Just Published!
More information about the nio-discuss