Copyright 2002 by aragost

com.aragost.io
Class FileUtils

java.lang.Object
  |
  +--com.aragost.io.FileUtils

public abstract class FileUtils
extends java.lang.Object

Abstract class with various utility functions related to files and dictionaries.


Constructor Summary
FileUtils()
           
 
Method Summary
static boolean delete(java.io.File file)
          Delete the specified file.
static void move(java.io.File src, java.io.File dst)
          Move the contents from one file to another.
static java.lang.String readFile(java.io.File f)
          Read the specifed file and return the contents as a String
static java.util.Iterator traverse(java.io.File root)
           
static java.util.Iterator traverse(java.io.File root, java.io.FileFilter filter)
           
static java.util.Iterator traverse(java.io.File root, java.lang.String extension)
           
static java.util.Iterator traverse(java.io.File root, java.lang.String extension, boolean includeDirs)
           
static void trim(java.io.File f)
          Trim the specified file.
static void writeFile(java.io.File f, java.lang.String contents)
          Write the specified String to the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

readFile

public static java.lang.String readFile(java.io.File f)
                                 throws java.io.IOException
Read the specifed file and return the contents as a String

Parameters:
f - The file to read
Returns:
The contents of the file
Throws:
java.io.IOException

writeFile

public static void writeFile(java.io.File f,
                             java.lang.String contents)
                      throws java.io.IOException
Write the specified String to the specified file.

Parameters:
f - The file to read
contents - The contents to write to the file
Throws:
java.io.IOException

trim

public static void trim(java.io.File f)
                 throws java.io.IOException
Trim the specified file. Trimming means to remove white spaces at the begenning and end.

java.io.IOException

move

public static void move(java.io.File src,
                        java.io.File dst)
                 throws java.io.IOException
Move the contents from one file to another. This method also handles if the files are on different devices.

Parameters:
src - The file to copy
dst - The file to write to
Throws:
java.io.IOException

delete

public static boolean delete(java.io.File file)
Delete the specified file. Will also delete non-empty directories.


traverse

public static java.util.Iterator traverse(java.io.File root)

traverse

public static java.util.Iterator traverse(java.io.File root,
                                          java.lang.String extension)

traverse

public static java.util.Iterator traverse(java.io.File root,
                                          java.lang.String extension,
                                          boolean includeDirs)

traverse

public static java.util.Iterator traverse(java.io.File root,
                                          java.io.FileFilter filter)

Copyright 2002 by aragost