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
protected static java.lang.String REGEXP_SITE_RESOURCES_XML
           
protected static java.lang.String REGEXP_SITE_TECH
           
protected static java.lang.String REGEXP_SITE_TECH_DIRECTORY
           
protected static java.lang.String REGEXP_SITE_XDOC_XML
           
protected static java.lang.String REGEXP_SITE_XML
           
 
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 int 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 int copyFileToDirectoryIfModified(java.io.File source, java.io.File destinationDirectory)
          Copy file from source to destination only if source is newer than the target file.
static int getNbFileCopy()
           
static int getNbFileModified()
           
static void setNbFileCopy(int nbFileCopy)
           
static void setNbFileModified(int nbFileMdofied)
           
 
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
 

Field Detail

REGEXP_SITE_XDOC_XML

protected static final java.lang.String REGEXP_SITE_XDOC_XML
See Also:
Constant Field Values

REGEXP_SITE_RESOURCES_XML

protected static final java.lang.String REGEXP_SITE_RESOURCES_XML
See Also:
Constant Field Values

REGEXP_SITE_TECH

protected static final java.lang.String REGEXP_SITE_TECH
See Also:
Constant Field Values

REGEXP_SITE_TECH_DIRECTORY

protected static final java.lang.String REGEXP_SITE_TECH_DIRECTORY
See Also:
Constant Field Values

REGEXP_SITE_XML

protected static final java.lang.String REGEXP_SITE_XML
See Also:
Constant Field Values
Constructor Detail

FileUtils

public FileUtils()
Method Detail

getNbFileModified

public static int getNbFileModified()

setNbFileModified

public static void setNbFileModified(int nbFileMdofied)

getNbFileCopy

public static int getNbFileCopy()

setNbFileCopy

public static void setNbFileCopy(int nbFileCopy)

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 int 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 int 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-2008 Mairie de Paris. All Rights Reserved.