What methods should go into a java.util.Objects class in JDK 7? (original) (raw)
Ulf Zibis Ulf.Zibis at gmx.de
Mon Oct 12 13:03:10 UTC 2009
- Previous message: What methods should go into a java.util.Objects class in JDK 7?
- Next message: What methods should go into a java.util.Objects class in JDK 7?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Am 16.09.2009 18:08, Alan Bateman schrieb:
Joel Kamentz wrote:
:
Attempt to convert an URL to a local file, taking into account that it might be wrappered by jar:, that File.toURL doesn't process %20 and the like, etc. File.toURL is deprecated. You might want to look at File.toURI.
Anyway, I would like to see zip/jar URIs as valid parameter to open a file/path/stream/channel via new File(URI) or Paths.get(URI).
Delete files or sub-trees, catching exceptions and instead just return success / failure. This one comes up a lot and has been addressed in the file system API work in jdk7. So if you have a File f you can replace f.delete() with f.toPath().delete() and it will do what you want. Recursive delete is relatively easy too, using Files.walkFileTree. There's an example in the javadoc that does this (look in java.nio.file.FileVisitor).
I would like to see some convenience methods for deleting/copying subtrees, without having to implement the FileVisitor examples. Additionally something like Path#unlock() would be helpful, if copy/delete fails. For example see: http://diamondcs.com.au/freeutilities/fileunlocker.php
-Ulf
- Previous message: What methods should go into a java.util.Objects class in JDK 7?
- Next message: What methods should go into a java.util.Objects class in JDK 7?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]