Checking file access on Windows is expensive because it requires reading the DACL and computing the effective access to the file. To bypass this, the checkAccess implementation on Windows has a fast path for the check read case but unfortunately Files.isReadable isn't using that fast path. This has been reported here: http://mail.openjdk.java.net/pipermail/nio-dev/2012-May/001667.html The workaround for the short is to replace Files.isReadbale(path) with path.getFileSystem().provider().checkAccess(path).
|