public class FileUtils
extends org.codehaus.plexus.util.FileUtils
copyDirectoryStructureIfModified
;Modifier and Type | Field and Description |
---|---|
protected static String |
REGEXP_SITE_RESOURCES_XML |
protected static String |
REGEXP_SITE_TECH |
protected static String |
REGEXP_SITE_TECH_DIRECTORY |
protected static String |
REGEXP_SITE_XDOC_XML |
protected static String |
REGEXP_SITE_XML |
Constructor and Description |
---|
FileUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
copyDirectoryStructure(File sourceDirectory,
File destinationDirectory)
Copies an entire directory structure.
|
static void |
copyDirectoryStructureIfModified(File sourceDirectory,
File destinationDirectory)
Copies an entire directory structure but only source files with timestamp
later than the destinations'.
|
static void |
copyFile(File source,
File destination)
Copy file from source to destination.
|
static boolean |
copyFileIfModified(File source,
File destination)
Copy file from source to destination only if source timestamp is later
than the destination timestamp.
|
static void |
copyFileToDirectoryIfModified(File source,
File destinationDirectory)
Copy file from source to destination only if source is newer than the
target file.
|
static void |
createFile(String strFolderPath,
String strFileName,
String strFileOutPut)
Create a file.
|
static void |
deleteFile(String strFolderPath,
String strFileName)
Delete a file
|
static int |
getNbFileCopy()
Gets the nb file copy.
|
static int |
getNbFileModified()
Gets the nb file modified.
|
static String |
readLastLine(String strFile)
Read the last line from the given file
|
static void |
setNbFileCopy(int nbFileCopy)
Sets the nb file copy.
|
static void |
setNbFileModified(int nbFileMdofied)
Sets the nb file modified.
|
static void |
writeToFile(String strContent,
String strFile)
Write to the given file
|
basename, basename, byteCountToDisplaySize, catPath, cleanDirectory, cleanDirectory, contentEquals, copyDirectory, copyDirectory, copyDirectoryLayout, copyFile, copyFile, copyFileToDirectory, copyFileToDirectory, copyFileToDirectoryIfModified, copyStreamToFile, copyURLToFile, createTempFile, deleteDirectory, deleteDirectory, dirname, extension, fileAppend, fileAppend, fileDelete, fileExists, filename, fileRead, fileRead, fileRead, fileRead, fileWrite, fileWrite, fileWrite, fileWrite, forceDelete, forceDelete, forceDeleteOnExit, forceMkdir, getDefaultExcludes, getDefaultExcludesAsList, getDefaultExcludesAsString, getDirectoryNames, getDirectoryNames, getExtension, getFile, getFileAndDirectoryNames, getFileNames, getFileNames, getFiles, getFiles, getFilesFromExtension, getPath, getPath, isValidWindowsFileName, loadFile, mkdir, normalize, removeExtension, removePath, removePath, rename, resolveFile, sizeOfDirectory, sizeOfDirectory, toFile, toURLs, waitFor, waitFor
protected static final String REGEXP_SITE_XDOC_XML
protected static final String REGEXP_SITE_RESOURCES_XML
protected static final String REGEXP_SITE_TECH
protected static final String REGEXP_SITE_TECH_DIRECTORY
protected static final String REGEXP_SITE_XML
public static int getNbFileModified()
public static void setNbFileModified(int nbFileMdofied)
nbFileMdofied
- the new nb file modifiedpublic static int getNbFileCopy()
public static void setNbFileCopy(int nbFileCopy)
nbFileCopy
- the new nb file copypublic static void copyDirectoryStructureIfModified(File sourceDirectory, File destinationDirectory) throws IOException
sourceDirectory
must exists.
sourceDirectory
- the source directory.destinationDirectory
- the destination directory.IOException
- if an I/O exception occurs.public static void copyDirectoryStructure(File sourceDirectory, File destinationDirectory) throws IOException
sourceDirectory
must exists.
sourceDirectory
- the source directory.destinationDirectory
- the destination directory.IOException
- if an I/O exception occurs.public static void copyFileToDirectoryIfModified(File source, File destinationDirectory) throws IOException
destinationDirectory
does not exist, it
(and any parent directories) will be created. If a file
source
in destinationDirectory
exists, it
will be overwritten.source
- An existing File
to copy.destinationDirectory
- A directory to copy source
into.FileNotFoundException
- if source
isn't a normal file.IllegalArgumentException
- if destinationDirectory
isn't a directory.IOException
- if source
does not exist, the file in
destinationDirectory
cannot be written to, or
an IO error occurs during copying.public static boolean copyFileIfModified(File source, File destination) throws IOException
destination
will be created if they don't already exist.
destination
will be overwritten if it already exists.source
- An existing non-directory File
to copy bytes
from.destination
- A non-directory File
to write bytes to
(possibly overwriting).IOException
- if source
does not exist,
destination
cannot be written to, or an IO
error occurs during copying.FileNotFoundException
- if destination
is a directory (use
FileUtils.copyFileToDirectory(java.lang.String, java.lang.String)
).public static void copyFile(File source, File destination) throws IOException
destination
will be created if they don't already exist.
destination
will be overwritten if it already exists.source
- An existing non-directory File
to copy bytes
from.destination
- A non-directory File
to write bytes to
(possibly overwriting).IOException
- if source
does not exist,
destination
cannot be written to, or an IO
error occurs during copying.FileNotFoundException
- if destination
is a directory (use
FileUtils.copyFileToDirectory(java.lang.String, java.lang.String)
).public static void createFile(String strFolderPath, String strFileName, String strFileOutPut) throws IOException
strFolderPath
- the folder pathstrFileName
- the file namestrFileOutPut
- the file outputIOException
- exception if there is an error during the deletionpublic static void deleteFile(String strFolderPath, String strFileName) throws IOException
strFolderPath
- the folder pathstrFileName
- the file nameIOException
- exception if there is an error during the deletionpublic static String readLastLine(String strFile)
strFile
- the file absolute path (ex : /home/filetopath/file.txt)Copyright © 2006–2015 Mairie de Paris. All rights reserved.