public class FileUtils extends Object
| Constructor and Description |
|---|
FileUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
deleteIfExists(File file)
Delete file or directory (empty or not)
|
static String |
fileToString(File file)
Read text file contents into a String
|
static String |
tempFile(String data)
Write data to temporary file (deleted on exit), and return path
|
static String |
tempFile(String data,
boolean keep)
Write data to temporary file, and return path
|
public static void deleteIfExists(File file) throws IOException
file - The file or directory to deleteIOExceptionpublic static String tempFile(String data) throws IOException
data - The data to writeIOExceptionpublic static String tempFile(String data, boolean keep) throws IOException
data - The data to writekeep - false means delete on exit, true means persistent fileIOExceptionpublic static String fileToString(File file) throws IOException
file - The text file to readIOExceptionCopyright © 2020 OW2. All Rights Reserved.