Modifier and Type | Field and Description |
---|---|
static boolean |
debug |
Constructor and Description |
---|
Files() |
Modifier and Type | Method and Description |
---|---|
static void |
appendToFile(File file,
String content)
Appends content to a file.
|
static void |
clearFile(File file) |
static void |
createFile(File file,
String content)
Creates a new file with the given content or replaces the content of a
file.
|
static void |
deleteFile(File file) |
static void |
deleteFile(String file) |
static void |
mkdir(String dir) |
static String |
readFile(File file)
Reads in a file.
|
static String |
readFile(URL file)
Reads input from a URL and stores it in a string (only recommend for small files).
|
static String[] |
readFileAsArray(File file)
Reads in a file as Array
|
static Object |
readObjectfromFile(File file) |
static void |
writeObjectToFile(Object obj,
File file)
writes a serializable Object to a File.
|
static void |
writeToFile(String content,
File file)
Write content to a file.
|
public static boolean debug
public Files()
public static String readFile(URL file) throws IOException
file
- URL of a file.IOException
- URL not accessible or content cannot be read for some reason.public static String readFile(File file) throws IOException
file
- The file to read.IOException
public static String[] readFileAsArray(File file) throws IOException
file
- The file to read.IOException
public static void writeObjectToFile(Object obj, File file)
obj
- the objectfile
- the filepublic static Object readObjectfromFile(File file)
public static void createFile(File file, String content)
file
- The file to use.content
- Content of the file.public static void appendToFile(File file, String content)
file
- The file to create.content
- Content of the file.public static void writeToFile(String content, File file) throws IOException
file
- The file to create.content
- Content of the file.IOException
public static void deleteFile(String file)
public static void deleteFile(File file)
DL-Learner is licenced under the terms of the GNU General Public License.
Copyright © 2007-2019 Jens Lehmann