public class FileUtil
extends Object
Constructor and Description |
---|
FileUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
appendParentheticalSuffix(String fileName,
String suffix) |
static String |
appendSuffix(String fileName,
String suffix) |
static void |
copyDirectory(File source,
File destination) |
static void |
copyDirectory(String sourceDirName,
String destinationDirName) |
static void |
copyFile(File source,
File destination) |
static void |
copyFile(File source,
File destination,
boolean lazy) |
static void |
copyFile(String source,
String destination) |
static void |
copyFile(String source,
String destination,
boolean lazy) |
static File |
createTempFile() |
static File |
createTempFile(byte[] bytes) |
static File |
createTempFile(InputStream is) |
static File |
createTempFile(String extension) |
static File |
createTempFile(String prefix,
String extension) |
static String |
createTempFileName() |
static String |
createTempFileName(String extension) |
static String |
createTempFileName(String prefix,
String extension) |
static File |
createTempFolder() |
static String |
decodeSafeFileName(String fileName) |
static boolean |
delete(File file) |
static boolean |
delete(String file) |
static void |
deltree(File directory) |
static void |
deltree(String directory) |
static String |
encodeSafeFileName(String fileName) |
static boolean |
exists(File file) |
static boolean |
exists(String fileName) |
static String |
extractText(InputStream is,
String fileName)
Extracts the text from the input stream and file name.
|
static String |
extractText(InputStream is,
String fileName,
int maxStringLength) |
static String[] |
find(String directory,
String includes,
String excludes) |
static String |
getAbsolutePath(File file) |
static byte[] |
getBytes(Class<?> clazz,
String fileName) |
static byte[] |
getBytes(File file) |
static byte[] |
getBytes(InputStream is) |
static byte[] |
getBytes(InputStream is,
int bufferSize) |
static byte[] |
getBytes(InputStream is,
int bufferSize,
boolean cleanUpStream) |
static String |
getExtension(String fileName) |
static File |
getFile() |
static String |
getMD5Checksum(File file) |
static String |
getPath(String fullFileName) |
static String |
getShortFileName(String fullFileName) |
static boolean |
isAscii(File file) |
static boolean |
isSameContent(File file,
byte[] bytes,
int length) |
static boolean |
isSameContent(File file,
String s) |
static String[] |
listDirs(File file) |
static String[] |
listDirs(String fileName) |
static String[] |
listFiles(File file) |
static String[] |
listFiles(String fileName) |
static void |
mkdirs(File file) |
static void |
mkdirs(String pathName) |
static boolean |
move(File source,
File destination) |
static boolean |
move(String sourceFileName,
String destinationFileName) |
static String |
read(File file) |
static String |
read(File file,
boolean raw) |
static String |
read(String fileName) |
static String |
replaceSeparator(String fileName) |
void |
setFile(File file) |
static File[] |
sortFiles(File[] files) |
static String |
stripExtension(String fileName) |
static String |
stripParentheticalSuffix(String fileName) |
static List<String> |
toList(Reader reader) |
static List<String> |
toList(String fileName) |
static Properties |
toProperties(FileInputStream fis) |
static Properties |
toProperties(String fileName) |
static void |
touch(File file) |
static void |
touch(String fileName) |
static void |
unzip(File source,
File destination) |
static void |
write(File file,
byte[] bytes) |
static void |
write(File file,
byte[] bytes,
boolean append) |
static void |
write(File file,
byte[] bytes,
int offset,
int length) |
static void |
write(File file,
byte[] bytes,
int offset,
int length,
boolean append) |
static void |
write(File file,
InputStream is) |
static void |
write(File file,
String s) |
static void |
write(File file,
String s,
boolean lazy) |
static void |
write(File file,
String s,
boolean lazy,
boolean append) |
static void |
write(String fileName,
byte[] bytes) |
static void |
write(String fileName,
InputStream is) |
static void |
write(String fileName,
String s) |
static void |
write(String fileName,
String s,
boolean lazy) |
static void |
write(String fileName,
String s,
boolean lazy,
boolean append) |
static void |
write(String pathName,
String fileName,
String s) |
static void |
write(String pathName,
String fileName,
String s,
boolean lazy) |
static void |
write(String pathName,
String fileName,
String s,
boolean lazy,
boolean append) |
public static String appendParentheticalSuffix(String fileName, String suffix)
public static String appendSuffix(String fileName, String suffix)
public static void copyDirectory(File source, File destination) throws IOException
IOException
public static void copyDirectory(String sourceDirName, String destinationDirName) throws IOException
IOException
public static void copyFile(File source, File destination) throws IOException
IOException
public static void copyFile(File source, File destination, boolean lazy) throws IOException
IOException
public static void copyFile(String source, String destination) throws IOException
IOException
public static void copyFile(String source, String destination, boolean lazy) throws IOException
IOException
public static File createTempFile()
public static File createTempFile(byte[] bytes) throws IOException
IOException
public static File createTempFile(InputStream is) throws IOException
IOException
public static File createTempFile(String extension)
public static File createTempFile(String prefix, String extension)
public static String createTempFileName()
public static String createTempFileName(String extension)
public static String createTempFileName(String prefix, String extension)
public static File createTempFolder() throws IOException
IOException
public static String decodeSafeFileName(String fileName)
public static boolean delete(File file)
public static boolean delete(String file)
public static void deltree(File directory)
public static void deltree(String directory)
public static String encodeSafeFileName(String fileName)
public static boolean exists(File file)
public static boolean exists(String fileName)
public static String extractText(InputStream is, String fileName)
is
- the file's input streamfileName
- the file's full name or extension (e.g., "Test.doc" or
".doc")public static String extractText(InputStream is, String fileName, int maxStringLength)
public static String[] find(String directory, String includes, String excludes)
public static String getAbsolutePath(File file)
public static byte[] getBytes(Class<?> clazz, String fileName) throws Exception
Exception
public static byte[] getBytes(File file) throws IOException
IOException
public static byte[] getBytes(InputStream is) throws IOException
IOException
public static byte[] getBytes(InputStream is, int bufferSize) throws IOException
IOException
public static byte[] getBytes(InputStream is, int bufferSize, boolean cleanUpStream) throws IOException
IOException
public static String getExtension(String fileName)
public static File getFile()
public static String getMD5Checksum(File file) throws IOException
IOException
public static String getPath(String fullFileName)
public static String getShortFileName(String fullFileName)
public static boolean isAscii(File file) throws IOException
IOException
public static boolean isSameContent(File file, byte[] bytes, int length)
public static boolean isSameContent(File file, String s)
public static String[] listDirs(File file)
public static String[] listDirs(String fileName)
public static String[] listFiles(File file)
public static String[] listFiles(String fileName)
public static void mkdirs(File file) throws IOException
IOException
public static void mkdirs(String pathName)
public static boolean move(File source, File destination)
public static boolean move(String sourceFileName, String destinationFileName)
public static String read(File file) throws IOException
IOException
public static String read(File file, boolean raw) throws IOException
IOException
public static String read(String fileName) throws IOException
IOException
public static String replaceSeparator(String fileName)
public static File[] sortFiles(File[] files)
public static String stripExtension(String fileName)
public static String stripParentheticalSuffix(String fileName)
public static List<String> toList(Reader reader)
public static List<String> toList(String fileName)
public static Properties toProperties(FileInputStream fis)
public static Properties toProperties(String fileName)
public static void touch(File file) throws IOException
IOException
public static void touch(String fileName) throws IOException
IOException
public static void unzip(File source, File destination)
public static void write(File file, byte[] bytes) throws IOException
IOException
public static void write(File file, byte[] bytes, boolean append) throws IOException
IOException
public static void write(File file, byte[] bytes, int offset, int length) throws IOException
IOException
public static void write(File file, byte[] bytes, int offset, int length, boolean append) throws IOException
IOException
public static void write(File file, InputStream is) throws IOException
IOException
public static void write(File file, String s) throws IOException
IOException
public static void write(File file, String s, boolean lazy) throws IOException
IOException
public static void write(File file, String s, boolean lazy, boolean append) throws IOException
IOException
public static void write(String fileName, byte[] bytes) throws IOException
IOException
public static void write(String fileName, InputStream is) throws IOException
IOException
public static void write(String fileName, String s) throws IOException
IOException
public static void write(String fileName, String s, boolean lazy) throws IOException
IOException
public static void write(String fileName, String s, boolean lazy, boolean append) throws IOException
IOException
public static void write(String pathName, String fileName, String s) throws IOException
IOException
public static void write(String pathName, String fileName, String s, boolean lazy) throws IOException
IOException
public static void write(String pathName, String fileName, String s, boolean lazy, boolean append) throws IOException
IOException
public void setFile(File file)