|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.dllearner.utilities.Files
public class Files
| Field Summary | |
|---|---|
static boolean |
debug
|
| Constructor Summary | |
|---|---|
Files()
|
|
| Method Summary | |
|---|---|
static void |
appendFile(File file,
String content)
Appends content to a file. |
static void |
backupDirectory(String dir)
copies all files in dir to "tmp/"+System.currentTimeMillis() |
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 |
deleteDir(String dir)
deletes all Files in the dir, does not delete the dir itself no warning is issued, use with care, cannot undelete files |
static void |
deleteFile(File file)
|
static void |
deleteFile(String file)
|
static String[] |
listDir(String dir)
lists all files in a directory |
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. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static boolean debug
| Constructor Detail |
|---|
public Files()
| Method Detail |
|---|
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 FileNotFoundException,
IOException
file - The file to read.
FileNotFoundException
IOException
public static String[] readFileAsArray(File file)
throws FileNotFoundException,
IOException
file - The file to read.
FileNotFoundException
IOException
public static void writeObjectToFile(Object obj,
File file)
obj - file - public 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 appendFile(File file,
String content)
file - The file to create.content - Content of the file.public static void clearFile(File file)
public static void deleteFile(String file)
public static void deleteFile(File file)
public static void mkdir(String dir)
public static void deleteDir(String dir)
dir - without a separator e.g. tmp/dirtodeletepublic static String[] listDir(String dir)
dir - without a separator e.g. tmp/dir
public static void backupDirectory(String dir)
dir - the dir to be backupped
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||