|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.util.Files
public class Files
Understands utility methods related to files.
Method Summary | |
---|---|
static File |
currentFolder()
Returns the current directory. |
static void |
delete(File file)
Deletes the given file or directory. |
static List<String> |
fileNamesIn(String dirName,
boolean recurse)
Returns the names of the files inside the specified directory. |
static void |
flushAndClose(OutputStream out)
Flushes and closes the given . |
static void |
flushAndClose(Writer writer)
Flushes and closes the given . |
static File |
newFile(String path)
Creates a new file using the given path. |
static File |
newFolder(String path)
Creates a new folder using the given path. |
static File |
newTemporaryFile()
Creates a new file in the system's temporary folder. |
static File |
newTemporaryFolder()
Creates a new folder in the system's temporary folder. |
static File |
temporaryFolder()
Returns the system's temporary folder. |
static String |
temporaryFolderPath()
Returns the path of the system's temporary folder. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static List<String> fileNamesIn(String dirName, boolean recurse)
dirName
- the name of the directory to start the search from.recurse
- if true
, we will look in subdirectories.
IllegalArgumentException
- if the given directory name does not point to an existing directory.public static File temporaryFolder()
FilesException
- if this method cannot find or create the system's temporary folder.public static String temporaryFolderPath()
public static File newTemporaryFile()
concat(String.valueOf(System.currentTimeMillis()), ".txt");
public static File newTemporaryFolder()
System.currentTimeMillis();
public static File newFile(String path)
path
- the path of the new file.
FilesException
- if the path belongs to an existing non-empty directory.
FilesException
- if the path belongs to an existing file.
FilesException
- if any I/O error is thrown when creating the new file.public static File newFolder(String path)
path
- the path of the new folder.
FilesException
- if the path belongs to an existing non-empty directory.
FilesException
- if the path belongs to an existing file.
FilesException
- if any I/O error is thrown when creating the new folder.public static void flushAndClose(Writer writer)
Writer
. Any I/O errors catched by this method are ignored and
not rethrown.
writer
- the writer to flush and close.public static void flushAndClose(OutputStream out)
OutputStream
. Any I/O errors catched by this method are ignored
and not rethrown.
out
- the output stream to flush and close.public static File currentFolder()
FilesException
- if the current directory cannot be obtained.public static void delete(File file)
file
- the file or directory to delete.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |