Legacy java.io.File and new FileSystems
Michael Hall
hallmike at att.net
Sun Aug 15 06:43:57 PDT 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Aug 15, 2010, at 5:09 AM, Alan Bateman wrote:
> Michael Hall wrote:
>> However, this still seems to have limitations with regard to
>> legacy code.
>> If as indicated in the javadoc I start with
>> - -Djava.nio.file.spi.DefaultFileSystemProvider=<a custom file
>> system provider>
>> and run a simple program that does
>>
>> new java.io.File("TestFSP.java").exists();
>>
>> with verbose classloading it shows no nio is involved.
>>
> Your observation is correct. As I'm mentioned in other posts here,
> the java.io classes in jdk7 don't yet redirect when an alternative
> default provider is used. I should have been clearer about that
> during this discussion. Once that it is over the finish line then
> you should see the above invoking your provider.
Looking forward to it Alan. Thank you.
One further thought I had even though it may be early is that it
might not be quite as simple as I was thinking in that the
getFileSystem could simply return a nio FileSystem. The exists method
includes fs.getBooleanAttributes that I'm not sure is included in the
nio FileSystem. It might be needed in some cases to check for the
presence of a custom provider and do the toPath() route. For
consistency maybe even always do this taking the custom provider
property as an indication that they want to use the new API.
I will continue my own provider to work or test with the toPath() for
now which is fine.
Mike Hall hallmike at att dot net
http://www195.pair.com/mik3hall
http://www195.pair.com/mik3hall/home.html
http://sourceforge.net/projects/macnative
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
iJwEAQECAAYFAkxn7yYACgkQUvk/ZSaThTKU7wQAlBmrdEwK2uTABQo1osnm9NzW
rw5ZLbS9dgVRv+sPqcvw4AXIWuhU/QV6ou+pMjTF7bXzkKX1nJv+grPnbMcp/jiX
op0KnUvY0/lJPVbCnSgBwsMgbHrgrKyIC98Ow3eMS/8U1G2yJIUE8ynfviw44QCe
XW5pPe8Lb1J+bDuR+0Y=
=f3Zr
-----END PGP SIGNATURE-----
More information about the nio-discuss
mailing list