public class FileUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
EXTENSION_SEPARATOR |
Constructor and Description |
---|
FileUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
copyFile(File source,
File destination)
Copies the source file to the destination filename.
|
static void |
deleteFiles(String directoryName)
Deletes the files in the directory, but does not remove the directory.
|
static boolean |
directoryExists(String directoryName)
Returns true if the given directory exists.
|
static String |
extension(String path) |
static List |
getContents(String textFileName)
Returns a List of the String's in the text file, one per line.
|
static String |
name(String path) |
static String |
readText(File file)
Gets the contents of a text file as a single String
|
static String |
readText(String filename) |
static void |
setContents(String textFileName,
String contents)
Saves the String with the given filename
|
public static final String EXTENSION_SEPARATOR
public static void deleteFiles(String directoryName)
public static boolean directoryExists(String directoryName)
public static List getContents(String textFileName) throws FileNotFoundException, IOException
FileNotFoundException
IOException
public static String readText(String filename) throws IOException
IOException
public static String readText(File file) throws IOException
file
- IOException
public static void setContents(String textFileName, String contents) throws IOException
IOException
public static void copyFile(File source, File destination) throws IOException
IOException
Copyright © 2020. All Rights Reserved.