public class IoFileUtil extends Object
Modifier and Type | Method and Description |
---|---|
static IoFile |
castOrFail(File file) |
protected static void |
checkRenameDir(File fromDir,
File toDir)
Before starting a moveRecursively operation, which will make use of the
File.renameTo method, it is useful to determine, whether this is possible
or not.
|
static File |
createTempDirectory(String prefix)
Discussion for best solution:
http://stackoverflow.com/questions/617414/create-a-temporary-directory-in-java
|
static File |
createTempFile(String prefix,
String suffix) |
static File |
createTempFile(String prefix,
String suffix,
File dir) |
static File |
getIoFile(File file) |
static File[] |
listRoots() |
static void |
moveRecursively(File fromDir,
File toDir)
Directories will be created/deleted, files renamed.
|
static File |
newFileNameForRenameTo(File fromDir,
File toDir,
File current) |
public static File createTempDirectory(String prefix) throws IOException
IOException
public static File createTempFile(String prefix, String suffix) throws IOException
IOException
public static File createTempFile(String prefix, String suffix, File dir) throws IOException
IOException
public static IoFile castOrFail(File file)
public static void moveRecursively(File fromDir, File toDir) throws IOException
IOException
- If a directory itself could not be renamed, created or deleted.SecurityException
- Not catched. If this happens, some files will
be moved, some not, but no data loss should have happened.public static File newFileNameForRenameTo(File fromDir, File toDir, File current) throws IOException
fromDir
- The from-dir of a move operation.toDir
- The destination dir of a move operation.current
- The current file, to compute the new name for. Must be inside of fromDirIOException
protected static void checkRenameDir(File fromDir, File toDir) throws IOException
IOException
Copyright © 2013–2019. All rights reserved.