public class FileUtil
extends java.lang.Object
Constructor and Description |
---|
FileUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
backup(java.lang.String sourceFile,
java.lang.String targetFile) |
static void |
copy(java.io.File sourceFile,
java.io.File targetFile)
Copies one file to another.
|
static void |
copy(java.lang.String sourceFile,
java.lang.String targetFile) |
static void |
copyDir(java.io.File sourceDir,
java.io.File targetDir) |
static java.util.List<java.lang.String> |
getFilePaths(java.io.File f) |
static java.lang.String |
getHomeDir() |
static boolean |
isMac() |
static boolean |
isWindows() |
static java.lang.String |
load(java.lang.String fileName) |
static java.io.File |
makeFile(java.lang.String base,
java.lang.String suffix) |
static void |
move(java.lang.String sourceFile,
java.lang.String targetFile)
Moves one file to another.
|
static void |
purgeDir(java.io.File dir) |
static java.lang.String |
stripFileExtension(java.lang.String fileName)
Strips the extension from a filename, assuming that extensions follow the
standard convention of being the text following the last '.' character
in the filename.
|
static void |
unzip(java.io.File zipFile,
java.io.File targetDir) |
static void |
write(java.lang.String targetFile,
java.lang.String contents) |
static void |
zip(java.io.File zipFile,
java.io.File source) |
public static void move(java.lang.String sourceFile, java.lang.String targetFile) throws java.io.IOException
targetFile
this method will overwrite its contents.sourceFile
- targetFile
- java.io.IOException
public static void backup(java.lang.String sourceFile, java.lang.String targetFile) throws java.io.IOException
java.io.IOException
public static void copy(java.io.File sourceFile, java.io.File targetFile) throws java.io.IOException
targetFile
this method will overwrite its contents.sourceFile
- targetFile
- java.io.IOException
public static void copy(java.lang.String sourceFile, java.lang.String targetFile) throws java.io.IOException
java.io.IOException
public static void write(java.lang.String targetFile, java.lang.String contents) throws java.io.IOException
java.io.IOException
public static java.lang.String stripFileExtension(java.lang.String fileName)
fileName
- public static void purgeDir(java.io.File dir)
public static void copyDir(java.io.File sourceDir, java.io.File targetDir) throws java.io.IOException
java.io.IOException
public static void unzip(java.io.File zipFile, java.io.File targetDir) throws java.io.IOException
java.io.IOException
public static void zip(java.io.File zipFile, java.io.File source) throws java.io.IOException
java.io.IOException
public static java.util.List<java.lang.String> getFilePaths(java.io.File f)
public static java.lang.String load(java.lang.String fileName) throws java.io.IOException
java.io.IOException
public static java.lang.String getHomeDir()
public static boolean isWindows()
public static boolean isMac()
public static java.io.File makeFile(java.lang.String base, java.lang.String suffix)