|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.jonclark.util.FileUtils
public class FileUtils
Convenience methods for deailing with files
| Constructor Summary | |
|---|---|
FileUtils()
|
|
| Method Summary | |
|---|---|
void |
copyFile(File in,
File out)
Copies a file using NIO |
static File |
createFileWithPath(String path)
Returns a file with the given path, which is guaranteed to exist on return |
static String |
forceLeadingDotSlash(String str)
Adds a leading ./ to a file path string if and only if the path string is not an absolute path. |
static String |
forceTrailingSlash(String str)
Adds a trailing slash to a directory path string if and only if the path string does not already end with a trailing slash. |
static PrintStream |
getFileForWriting(File f)
|
static File[] |
getFilesWithExt(File root,
String ext)
Get files having extention |
static boolean |
isAbsolutePath(String str)
Determines whether a path string is a relative or absolute path. |
static BufferedReader |
openTextFile(File f)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileUtils()
| Method Detail |
|---|
public void copyFile(File in,
File out)
throws IOException
in - The source fileout - The destination file
IOException
public static File createFileWithPath(String path)
throws IOException
path -
IOException
public static BufferedReader openTextFile(File f)
throws FileNotFoundException
FileNotFoundException
public static PrintStream getFileForWriting(File f)
throws FileNotFoundException
FileNotFoundExceptionpublic static String forceTrailingSlash(String str)
str - The path string
public static String forceLeadingDotSlash(String str)
str -
public static boolean isAbsolutePath(String str)
str - The path string to be analyzed
public static File[] getFilesWithExt(File root,
String ext)
ext - e.g. ".txt"
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||