|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.team.fvt.tests.utils.FileUtil
public class FileUtil
Utilities to manipulate files and directories on disk through java.io
Note that this code has been initially copied from JFS team...
Constructor Summary | |
---|---|
FileUtil()
|
Method Summary | |
---|---|
static void |
copyDir(java.io.File sourceDir,
java.io.File destDir)
Copy all files from source dircetory to destination directory. |
static java.io.File |
copyFile(java.io.File sourceFile,
java.io.File destDir)
Copy the given source file to the given destination directory. |
static java.io.File |
copyFile(java.io.File sourceFile,
java.io.File destDir,
java.lang.String destFile)
Copy the given source file to the given destination directory with a different name. |
static void |
deleteFile(java.io.File file)
Delete the given file. |
static java.lang.String |
readFileContent(java.io.File file)
Read the content of the gievn file, assuming it's a text file. |
static void |
rmdir(java.io.File dir)
Delete an entire directory hierarchy including all files. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileUtil()
Method Detail |
---|
public static void copyDir(java.io.File sourceDir, java.io.File destDir) throws java.io.IOException
sourceDir
- The source directorydestDir
- The destination directory
java.io.IOException
public static java.io.File copyFile(java.io.File sourceFile, java.io.File destDir) throws java.io.IOException
sourceFile
- The file to copydestDir
- The directory where to copy the file
File
java.io.IOException
public static java.io.File copyFile(java.io.File sourceFile, java.io.File destDir, java.lang.String destFile) throws java.io.IOException
sourceFile
- The file to copydestDir
- The directory where to copy the filedestFile
- The new file name
File
java.io.IOException
public static void deleteFile(java.io.File file) throws java.io.IOException
Note that if the deletion fails, it's performed again until success or five consecutive failures.
file
- The file to delete
java.io.IOException
public static java.lang.String readFileContent(java.io.File file) throws java.io.IOException
file
- The file to read
String
.
java.io.IOException
public static void rmdir(java.io.File dir) throws java.io.IOException
dir
- The directory to delete
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |