|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.pixelmed.utils.FileUtilities
public class FileUtilities
Various static methods helpful for handling files.
| Method Summary | |
|---|---|
static File |
getFileFromNameInsensitiveToCaseIfNecessary(String fileName)
Determine if a file corresponding to the specified name exists, checking for case insensitive variants if necessary. |
static ArrayList |
listFilesRecursively(File initialPath)
Recursively traverse the specified directory and its sub-directory and produce a list of all the files contained therein, in no particular order. |
static String |
makePathToFileInUsersHomeDirectory(String fileName)
Given a file name, such as the properties file name, make a path to it in the user's home directory. |
static String |
makeTemporaryFileName()
Create a temporary filename. |
static String |
readFile(File file)
Read an entire file into a string. |
static String |
readFile(InputStream stream)
Read an entire file into a string. |
static String |
readFile(Reader reader)
Read an entire file into a string. |
static String |
readFile(String filename)
Read an entire file into a string. |
static void |
renameElseCopyTo(File srcFile,
File dstFile)
Rename a file, if possible, else make a copy of it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static final void renameElseCopyTo(File srcFile,
File dstFile)
throws IOException
Rename a file, if possible, else make a copy of it.
srcFile - the sourcedstFile - the destination
IOException - thrown if the copying fails for any reasonpublic static final ArrayList listFilesRecursively(File initialPath)
Recursively traverse the specified directory and its sub-directory and produce a list of all the files contained therein, in no particular order.
If the path is a file, just return that.
Any security (permission) exceptions are caught and logged to stderr and not propagated.
initialPath - The abstract pathname of the directory to begin searching
public static final String readFile(Reader reader)
throws IOException
Read an entire file into a string.
reader - The file reader
String.
If - an IO error occurs.
IOException
public static final String readFile(InputStream stream)
throws IOException
Read an entire file into a string.
stream - The input stream (e.g., from class.getResourceAsStream())
String.
If - an IO error occurs.
IOException
public static final String readFile(File file)
throws IOException
Read an entire file into a string.
file - The file
String.
If - an IO error occurs.
IOException
public static final String readFile(String filename)
throws IOException
Read an entire file into a string.
filename - The file
String.
If - an IO error occurs.
IOException
public static final File getFileFromNameInsensitiveToCaseIfNecessary(String fileName)
throws FileNotFoundException
Determine if a file corresponding to the specified name exists, checking for case insensitive variants if necessary.
fileName - The name of the file to find
If - the file cannot be found.
FileNotFoundExceptionpublic static final String makeTemporaryFileName()
Create a temporary filename.
public static final String makePathToFileInUsersHomeDirectory(String fileName)
Given a file name, such as the properties file name, make a path to it in the user's home directory.
fileName - the file name to make a path to
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||