Questions on the NIO.2 API

Martijn Verburg martijnverburg at gmail.com
Mon Jan 31 09:00:17 PST 2011


Hi Alan,

The FileStore object's type is simply a String as opposed to a constant,
>> enum or other defined type.  This makes it very hard to rely on for decision
>> making (as per the if statement I have above).  I assume this is a
>> limitation of being able to consistently detect the underlying storage type?
>>
> The FileStore name and type are really meant for display/informational
> purposes. Say for example someone right clicks on the FileStore to look at
> its properties and is shows the name, type, capacity, and space available.
> Maybe we need to make this clearer in the javadoc. Do you have examples in
> mind where you might do something differently if the volume is NTFS or FAT
> or whatever? The only cases that we do handle is where you want to know if
> the file store supports certain file attributes or not, and you can query
> file store specific attributes.
>

I think it could be made clearer in the Javadocs at the level of the class
description?  Something like that type and store are almost free text field
meta information?  The docs on the two getters for name and type are pretty
clear ("...implementation specific..").

I instinctively thought about using storage type as an additional check. For
example I may have plugged in an incorrect USB stick (with an incompatible
file storage) or some dastardly Hollywood villain has inserted a storage
device that's almost identical to the one that our system is used to seeing.
 Pity s/he didn't know about different storage types - sound the alarm!

Far fetched? Probably yes :-)

Cheers,
Martijn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20110131/2783e26e/attachment.html 


More information about the nio-dev mailing list