|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.webstersmalley.picweb.utils.IOUtils
public class IOUtils
Utility class for the basic file/IO related functions (eg
write out an Document as an XML file)
| Field Summary | |
|---|---|
private static org.apache.commons.logging.Log |
log
Logger for the class. |
| Constructor Summary | |
|---|---|
private |
IOUtils()
Private constructor - should only used via static utilities methods |
| Method Summary | |
|---|---|
static void |
copyFile(java.io.File src,
java.io.File dest)
Copies the contents of a file to a new one, creating subdirectories as necessary. |
static void |
copyFolderContents(java.lang.String src,
java.lang.String dest)
Copies the contents of one folder into another. |
static void |
purgeFolder(java.io.File folder)
Deletes the contents of a folder, leaving that folder intact. |
static void |
touch(java.io.File file)
Creates a blank (0-byte) file, creating folders as necessary. |
static void |
writeFile(java.lang.String filename,
java.lang.String contents)
Writes out a string as a file. |
static void |
writeXmlFile(java.lang.String filename,
org.w3c.dom.Document doc)
Writes out a Document as an XML file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static org.apache.commons.logging.Log log
| Constructor Detail |
|---|
private IOUtils()
| Method Detail |
|---|
public static void writeFile(java.lang.String filename,
java.lang.String contents)
throws java.io.FileNotFoundException
filename - the name of the new filecontents - the contents of the new file
java.io.FileNotFoundException - File wasn't found
public static void writeXmlFile(java.lang.String filename,
org.w3c.dom.Document doc)
throws java.lang.Exception
Document as an XML file.
filename - the filename of the new XML filedoc - the document to write
java.lang.Exception - wraps up exceptions from the IO and the transformation
public static void copyFolderContents(java.lang.String src,
java.lang.String dest)
throws java.io.IOException
src\file1
src\dir1\file2
src\dir1\file3
If we called copyFolderContents("src", "dest") we'd end up with:
dest\file1
dest\dir1\file2
dest\dir2\file3
src - Source folderdest - Destination folder
java.io.IOException
public static void copyFile(java.io.File src,
java.io.File dest)
throws java.io.IOException
src - Source filedest - Destination file
java.io.IOException
public static void purgeFolder(java.io.File folder)
throws java.io.IOException
folder - the folder to purge
java.io.IOException
public static void touch(java.io.File file)
throws java.io.IOException
file - the file to create
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||