net.slashie.util
Class FileUtil

java.lang.Object
  extended by net.slashie.util.FileUtil

public class FileUtil
extends java.lang.Object

Eases input and output with files.

Author:
Santiago Zapata

Constructor Summary
FileUtil()
           
 
Method Summary
static void copyFile(java.io.File source, java.io.File destination)
          Duplicates a file contents into another file
static void deleteFile(java.lang.String fileName)
          Deletes the specified file
static boolean fileExists(java.lang.String filename)
          Checks if the given file exists
static java.io.BufferedReader getReader(java.lang.String fileName)
          Acquires a Buffered reader usable to read the contents of a file
static java.io.BufferedWriter getWriter(java.lang.String fileName)
          Acquires a Buffered Writer usable to write a new file
static void main(java.lang.String[] args)
          Test Unit, can be changed
static java.lang.String replaceFilename(java.lang.String fullPath, java.lang.String newFilename)
          Replaces the file part of a full path with a new file name and returns the modified full path
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtil

public FileUtil()
Method Detail

deleteFile

public static void deleteFile(java.lang.String fileName)
Deletes the specified file

Parameters:
fileName - The file to be deleted

copyFile

public static void copyFile(java.io.File source,
                            java.io.File destination)
                     throws java.io.IOException
Duplicates a file contents into another file

Parameters:
source - The file to take the data from
destination - The filename to write the data to
Throws:
java.io.IOException

getReader

public static java.io.BufferedReader getReader(java.lang.String fileName)
                                        throws java.io.IOException
Acquires a Buffered reader usable to read the contents of a file

Parameters:
fileName - Name of the file that will be read
Returns:
The BufferedReader
Throws:
java.io.IOException

getWriter

public static java.io.BufferedWriter getWriter(java.lang.String fileName)
                                        throws java.io.IOException
Acquires a Buffered Writer usable to write a new file

Parameters:
fileName - The name of the file to be written
Returns:
Throws:
java.io.IOException

fileExists

public static boolean fileExists(java.lang.String filename)
Checks if the given file exists

Parameters:
filename -
Returns:

replaceFilename

public static java.lang.String replaceFilename(java.lang.String fullPath,
                                               java.lang.String newFilename)
Replaces the file part of a full path with a new file name and returns the modified full path

Parameters:
fullPath -
newFilename -
Returns:

main

public static void main(java.lang.String[] args)
Test Unit, can be changed

Parameters:
args -