com.ebmwebsourcing.easycommons.io
Class FileSystemHelper
java.lang.Object
com.ebmwebsourcing.easycommons.io.FileSystemHelper
public final class FileSystemHelper
- extends java.lang.Object
|
Method Summary |
static void |
cleanDirectory(java.io.File directory)
Cleans a directory without deleting it. |
static java.io.File |
createTempDir()
|
static java.io.File |
createTempDir(java.io.File parentDir,
java.lang.String prefix)
|
static java.io.File |
createTempDir(java.lang.String prefix)
|
static void |
forceDelete(java.io.File file)
Deletes a file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
createTempDir
public static java.io.File createTempDir()
throws java.io.IOException
- Throws:
java.io.IOException
createTempDir
public static java.io.File createTempDir(java.lang.String prefix)
throws java.io.IOException
- Throws:
java.io.IOException
createTempDir
public static java.io.File createTempDir(java.io.File parentDir,
java.lang.String prefix)
throws java.io.IOException
- Throws:
java.io.IOException
cleanDirectory
public static void cleanDirectory(java.io.File directory)
throws java.io.IOException
- Cleans a directory without deleting it.
- Parameters:
directory - directory to clean
- Throws:
java.io.IOException - in case cleaning is unsuccessful
forceDelete
public static void forceDelete(java.io.File file)
throws java.io.IOException
- Deletes a file. If file is a directory, delete it and all
sub-directories.
The difference between File.delete() and this method are:
- A directory to be deleted does not have to be empty.
- You get exceptions when a file or directory cannot be deleted.
(java.io.File methods returns a boolean)
- Parameters:
file - file or directory to delete, must not be null
- Throws:
java.lang.NullPointerException - if the directory is null
java.io.IOException - in case deletion is unsuccessful
Copyright © 2011 Petals Link. All Rights Reserved.