public class FileUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
FileUtils.FileStatus
File status information.
|
Modifier and Type | Field and Description |
---|---|
static int |
S_IRGRP |
static int |
S_IROTH |
static int |
S_IRUSR |
static int |
S_IRWXG |
static int |
S_IRWXO |
static int |
S_IRWXU |
static int |
S_IWGRP |
static int |
S_IWOTH |
static int |
S_IWUSR |
static int |
S_IXGRP |
static int |
S_IXOTH |
static int |
S_IXUSR |
Constructor and Description |
---|
FileUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
copyFile(java.io.File srcFile,
java.io.File destFile) |
static boolean |
copyToFile(java.io.InputStream inputStream,
java.io.File destFile)
Copy data from a source stream to destFile.
|
static boolean |
isFilenameSafe(java.io.File file)
Check if a filename is "safe" (no metacharacters or spaces).
|
static java.lang.String |
readTextFile(java.io.File file,
int max,
java.lang.String ellipsis)
Read a text file into a String, optionally limiting the length.
|
static boolean |
sync(java.io.FileOutputStream stream) |
public static final int S_IRWXU
public static final int S_IRUSR
public static final int S_IWUSR
public static final int S_IXUSR
public static final int S_IRWXG
public static final int S_IRGRP
public static final int S_IWGRP
public static final int S_IXGRP
public static final int S_IRWXO
public static final int S_IROTH
public static final int S_IWOTH
public static final int S_IXOTH
public static boolean copyFile(java.io.File srcFile, java.io.File destFile)
public static boolean copyToFile(java.io.InputStream inputStream, java.io.File destFile)
public static boolean isFilenameSafe(java.io.File file)
file
- The file to checkpublic static java.lang.String readTextFile(java.io.File file, int max, java.lang.String ellipsis) throws java.io.IOException
file
- to read (will not seek, so things like /proc files are OK)max
- length (positive for head, negative of tail, 0 for no limit)ellipsis
- to add of the file was truncated (can be null)java.io.IOException
- if something goes wrong reading the filepublic static boolean sync(java.io.FileOutputStream stream)