|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.northwestern.at.utils.FileUtils
public class FileUtils
File utilities.
This static class provides various utility methods for manipulating files.
Constructor Summary | |
---|---|
protected |
FileUtils()
Don't allow instantiation but do allow overrides. |
Method Summary | |
---|---|
static java.lang.String |
chdir(java.lang.String directory)
Change the current directory. |
static boolean |
copyFile(java.lang.String srcFileName,
java.lang.String destFileName)
Copy a file. |
static boolean |
createPath(java.io.File directory)
Create intermediate directories for a directory path. |
static boolean |
createPathForFile(java.lang.String fileName)
Create directory for specified file name. |
static java.lang.String |
getCurrentDirectory()
Get the current directory. |
static java.lang.String |
readTextFile(java.io.File file)
Read text file to a string. |
static java.lang.String |
readTextFile(java.io.File file,
java.lang.String encoding)
Read text file to a string. |
static java.lang.String |
readTextFile(java.lang.String fileName)
Read text file to a string. |
static java.lang.String |
readTextFile(java.lang.String fileName,
java.lang.String encoding)
Read text file to a string. |
static void |
writeTextFile(java.io.File file,
boolean append,
java.lang.String contents)
Write text file from a string. |
static void |
writeTextFile(java.io.File file,
boolean append,
java.lang.String contents,
java.lang.String encoding)
Write text file from a string. |
static void |
writeTextFile(java.lang.String fileName,
boolean append,
java.lang.String contents)
Write text file from a string. |
static void |
writeTextFile(java.lang.String fileName,
boolean append,
java.lang.String contents,
java.lang.String encoding)
Write text file from a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected FileUtils()
Method Detail |
---|
public static java.lang.String readTextFile(java.io.File file, java.lang.String encoding) throws java.io.IOException
file
- Text file to read from.encoding
- Text file encoding, e.g., "utf-8".
java.io.IOException
- if file cannot be read. public static java.lang.String readTextFile(java.io.File file) throws java.io.IOException
file
- Text file to read from.
java.io.IOException
- if file cannot be read. public static java.lang.String readTextFile(java.lang.String fileName, java.lang.String encoding) throws java.io.IOException
fileName
- Text file name to read from.encoding
- Text file encoding, e.g., "utf-8".
java.io.IOException
- if file cannot be read. public static java.lang.String readTextFile(java.lang.String fileName) throws java.io.IOException
fileName
- Text file name to read from.
java.io.IOException
- if file cannot be read. public static void writeTextFile(java.io.File file, boolean append, java.lang.String contents, java.lang.String encoding) throws java.io.IOException
file
- Text file to write to.contents
- String to write to file.append
- True to append contents to existing file.encoding
- Text file encoding, e.g., "utf-8".
java.io.IOException
- in case of I/O exception. public static void writeTextFile(java.io.File file, boolean append, java.lang.String contents) throws java.io.IOException
file
- Text file to write to.contents
- String to write to file.append
- True to append contents to existing file.
java.io.IOException
- in case of I/O exception. public static void writeTextFile(java.lang.String fileName, boolean append, java.lang.String contents, java.lang.String encoding) throws java.io.IOException
fileName
- Text file name to write to.contents
- String to write to file.append
- True to append contents to existing file.
java.io.IOException
- in case of I/O exception. public static void writeTextFile(java.lang.String fileName, boolean append, java.lang.String contents) throws java.io.IOException
fileName
- Text file name to write to.contents
- String to write to file.append
- True to append contents to existing file.
java.io.IOException
- in case of I/O exception. public static boolean copyFile(java.lang.String srcFileName, java.lang.String destFileName)
srcFileName
- Name of source file to copy.destFileName
- Name of destination file to which to copy.
public static boolean createPath(java.io.File directory)
directory
- The subdirectory for which to create any
missing intermediate directories.
public static boolean createPathForFile(java.lang.String fileName)
fileName
- File name for which to create
parent directory, if necessary.
public static java.lang.String getCurrentDirectory()
public static java.lang.String chdir(java.lang.String directory)
directory
- New directory to which to move.
Ignored if null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |