|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jmw.util.FileUtils
public class FileUtils
A group of static methods that are used for quick file manipulation, particularly reading and writing text files.
Constructor Summary | |
---|---|
FileUtils()
|
Method Summary | |
---|---|
static void |
bufferToFile(java.lang.StringBuffer sb,
java.io.File file)
Saves the contents of a StringBuffer to a file, using the default encoding. |
static void |
bufferToFile(java.lang.StringBuffer sb,
java.io.File file,
java.lang.String encoding)
Saves the contents of a StringBuffer to a file, using the specified encoding. |
static void |
bufferToFile(java.lang.StringBuffer sb,
java.lang.String fileName)
Saves the contents of a StringBuffer to a file, using the default encoding. |
static void |
bufferToFile(java.lang.StringBuffer sb,
java.lang.String fileName,
java.lang.String encoding)
Saves the contents of a StringBuffer to a file, using the default encoding. |
static java.lang.StringBuffer |
fileToStringBuffer(java.io.File file)
Retrieves an entire file and loads it into a StringBuffer. |
static java.lang.StringBuffer |
fileToStringBuffer(java.io.File file,
java.lang.String encoding)
Retrieves an entire file and loads it into a StringBuffer. |
static java.lang.StringBuffer |
fileToStringBuffer(java.lang.String fileName)
Retrieves an entire file and loads it into a StringBuffer. |
static java.lang.StringBuffer |
fileToStringBuffer(java.lang.String fileName,
java.lang.String encoding)
Retrieves an entire file and loads it into a StringBuffer. |
static java.io.File |
findSubDir(java.lang.String dirname)
|
static java.util.ArrayList<java.io.File> |
findSubDirectories(java.io.File root,
int level,
boolean leavesOnly)
Recursivly finds all of the subdirectories of a given root. |
static java.io.File |
getNewestLastModified(java.io.File dir)
Finds the most recently modified file in the given directory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileUtils()
Method Detail |
---|
public static java.lang.StringBuffer fileToStringBuffer(java.io.File file) throws java.io.IOException
file
- the file to be loaded
java.io.IOException
- if something went wrong opening or reading from the filepublic static java.lang.StringBuffer fileToStringBuffer(java.lang.String fileName) throws java.io.IOException
fileName
- the name of the file to be loaded
java.io.IOException
- if something went wrong opening or reading from the filepublic static java.lang.StringBuffer fileToStringBuffer(java.lang.String fileName, java.lang.String encoding) throws java.io.IOException
fileName
- the name of the file to be loadedencoding
- the encoding to use when reading the file
java.io.IOException
- if something went wrong opening or reading from the filepublic static java.lang.StringBuffer fileToStringBuffer(java.io.File file, java.lang.String encoding) throws java.io.IOException
file
- the file to be loadedencoding
- the encoding to use when reading the file
java.io.IOException
- if something went wrong opening or reading from the filepublic static void bufferToFile(java.lang.StringBuffer sb, java.lang.String fileName) throws java.io.IOException
sb
- the buffer to be savedfileName
- the name of the file that the buffer should be saved to
java.io.IOException
- if something went wrong opening or writing to the filepublic static void bufferToFile(java.lang.StringBuffer sb, java.lang.String fileName, java.lang.String encoding) throws java.io.IOException
sb
- the buffer to be savedfileName
- the name of the file that the buffer should be saved toencoding
- the encoding to use when reading the file
java.io.IOException
- if something went wrong opening or writing to the filepublic static void bufferToFile(java.lang.StringBuffer sb, java.io.File file) throws java.io.IOException
sb
- the buffer to be savedfile
- the file that the buffer should be saved to
java.io.IOException
- if something went wrong opening or writing to the filepublic static void bufferToFile(java.lang.StringBuffer sb, java.io.File file, java.lang.String encoding) throws java.io.IOException
sb
- the buffer to be savedfile
- the file that the buffer should be saved toencoding
- the encoding to use when writing the file
java.io.IOException
- if something went wrong opening or writing to the filepublic static java.util.ArrayList<java.io.File> findSubDirectories(java.io.File root, int level, boolean leavesOnly)
root
- the root directory from which to begin searching (need not be an actual
root dir.level
- The level of depth to transverse untilleavesOnly
- flag indicating whether to only return the leaves (those dirs at
the level of depth or all of the parent dirs as well
public static java.io.File getNewestLastModified(java.io.File dir)
dir
- the directory to search in
public static java.io.File findSubDir(java.lang.String dirname)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |