The JSR-203 file sytsem API has been in JDK 7 for a long time. A number of issues and changes have been accumulated and these need to be integrated into JDK 7.
The main update is to consolidate the file operations into Files to avoid confusion as to whether to add new file operations to Path, Files or Attributes. The Attributes class can be removed.
In addition we have:
1. Files requires a number of utility methods to make it quick and easy to do simple things:
List<String> readAllLines(Path, Charset)
long copy(InputStream, Path, CopyOption...)
long copy(Path, OutputStream)
Path write(Path, byte, OpenOption...)
Path write(Path, Iterable<? extends CharSequence>, Charset, OpenOption...)
2. The checkAccess method is hard to use and should be made available as simple isReadable,
isWritable, and isExecutable methods.
3. The API requires simple methods to test the file type, namely isDirectory, isRegularFile,
isSymbolicLink to avoiding needing to use readAttributes
4. The exists and notExists method need a LinkOption parameter so that they can be used
without following symbolic links.
5. The new createTempFile method added to java.io.File should be moved to Files and
createTempDirecory methods added.
6. Paths.get(String) and FileSystem.getPath should be updated to use var-args so make it
easy to join directory and file names.
7. Path requires a few updates:
- with the file operations moved to Files, and extension methods potentially coming in jdk8,
then we shuold consider changing it to an interface.
- getName() should be renamed to getFileName() to avoid confusing it with getName(int) and/or
expecting it to return a String
- we should add startsWith(String) and endsWith(String) to complement the existing methods
- a resolveSibling method should be added as it very common to want to "replace" the file
- normalize and relativize should return the empty path rather than null
8. FileSystems.newFileSystem(FileRef,Map,ClassLoader) does not need the Map (env) parameter.
9. For JDK7 we don't need FileStoreSpaceAttributes and it would be simpler to just have
FileStore define methods to return the space information.
10. The createFile and createDirectory methods need to be clear that they do not create
missing parent directories.
11. The newOutputStream and newByteChannel methods need to make it clear that the security
manager's checkDelete method is invoked if the DELETE_ON_CLOSE option is specified.
12. The copy/move methods should suggest that DirectoryNotEmptyException be thrown if
REPLACE_EXISTING is specified and the target is a non-empty direcory.