fr.paris.lutece.maven
Class FileUtils

java.lang.Object
  extended by org.codehaus.plexus.util.FileUtils
      extended by fr.paris.lutece.maven.FileUtils

public class FileUtils
extends org.codehaus.plexus.util.FileUtils

Utility class to manipulate files.
Note : these methods were copied from plexus-utils 1.2 because :


Field Summary
 
Fields inherited from class org.codehaus.plexus.util.FileUtils
FS, ONE_GB, ONE_KB, ONE_MB
 
Constructor Summary
FileUtils()
           
 
Method Summary
static void copyDirectoryStructure(java.io.File sourceDirectory, java.io.File destinationDirectory)
          Copies an entire directory structure.
static void copyDirectoryStructureIfModified(java.io.File sourceDirectory, java.io.File destinationDirectory)
          Copies an entire directory structure but only source files with timestamp later than the destinations'.
static void copyFile(java.io.File source, java.io.File destination)
          Copy file from source to destination.
static void copyFileIfModified(java.io.File source, java.io.File destination)
          Copy file from source to destination only if source timestamp is later than the destination timestamp.
static void copyFileToDirectoryIfModified(java.io.File source, java.io.File destinationDirectory)
          Copy file from source to destination only if source is newer than the target file.
 
Methods inherited from class org.codehaus.plexus.util.FileUtils
basename, basename, byteCountToDisplaySize, catPath, cleanDirectory, cleanDirectory, contentEquals, copyDirectory, copyDirectory, copyFileToDirectory, copyFileToDirectory, copyURLToFile, createTempFile, deleteDirectory, deleteDirectory, dirname, extension, fileAppend, fileDelete, fileExists, filename, fileRead, fileRead, fileWrite, forceDelete, forceDelete, forceDeleteOnExit, forceMkdir, getDefaultExcludes, getDefaultExcludesAsList, getExtension, getFile, getFileNames, getFileNames, getFiles, getFiles, getFilesFromExtension, getPath, getPath, mkdir, normalize, removeExtension, removePath, removePath, rename, resolveFile, sizeOfDirectory, sizeOfDirectory, toFile, toURLs, waitFor, waitFor
 
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

copyDirectoryStructureIfModified

public static void copyDirectoryStructureIfModified(java.io.File sourceDirectory,
                                                    java.io.File destinationDirectory)
                                             throws java.io.IOException
Copies an entire directory structure but only source files with timestamp later than the destinations'. Note:

Parameters:
sourceDirectory - the source directory.
destinationDirectory - the destination directory.
Throws:
java.io.IOException - if an I/O exception occurs.

copyDirectoryStructure

public static void copyDirectoryStructure(java.io.File sourceDirectory,
                                          java.io.File destinationDirectory)
                                   throws java.io.IOException
Copies an entire directory structure. Note:

Parameters:
sourceDirectory - the source directory.
destinationDirectory - the destination directory.
Throws:
java.io.IOException - if an I/O exception occurs.

copyFileToDirectoryIfModified

public static void copyFileToDirectoryIfModified(java.io.File source,
                                                 java.io.File destinationDirectory)
                                          throws java.io.IOException
Copy file from source to destination only if source is newer than the target file. If destinationDirectory does not exist, it (and any parent directories) will be created. If a file source in destinationDirectory exists, it will be overwritten.

Parameters:
source - An existing File to copy.
destinationDirectory - A directory to copy source into.
Throws:
java.io.FileNotFoundException - if source isn't a normal file.
java.lang.IllegalArgumentException - if destinationDirectory isn't a directory.
java.io.IOException - if source does not exist, the file in destinationDirectory cannot be written to, or an IO error occurs during copying.

copyFileIfModified

public static void copyFileIfModified(java.io.File source,
                                      java.io.File destination)
                               throws java.io.IOException
Copy file from source to destination only if source timestamp is later than the destination timestamp. The directories up to destination will be created if they don't already exist. destination will be overwritten if it already exists.

Parameters:
source - An existing non-directory File to copy bytes from.
destination - A non-directory File to write bytes to (possibly overwriting).
Throws:
java.io.IOException - if source does not exist, destination cannot be written to, or an IO error occurs during copying.
java.io.FileNotFoundException - if destination is a directory (use FileUtils.copyFileToDirectory(java.lang.String, java.lang.String)).

copyFile

public static void copyFile(java.io.File source,
                            java.io.File destination)
                     throws java.io.IOException
Copy file from source to destination. The directories up to destination will be created if they don't already exist. destination will be overwritten if it already exists.

Parameters:
source - An existing non-directory File to copy bytes from.
destination - A non-directory File to write bytes to (possibly overwriting).
Throws:
java.io.IOException - if source does not exist, destination cannot be written to, or an IO error occurs during copying.
java.io.FileNotFoundException - if destination is a directory (use FileUtils.copyFileToDirectory(java.lang.String, java.lang.String)).


Copyright © 2006-2007 Mairie de Paris. All Rights Reserved.