|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.plexus.util.FileUtils
fr.paris.lutece.maven.FileUtils
public class FileUtils
Utility class to manipulate files.
Note : these methods were copied from plexus-utils 1.2 because :
copyDirectoryStructureIfModified
;
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.codehaus.plexus.util.FileUtils |
---|
org.codehaus.plexus.util.FileUtils.FilterWrapper |
Field Summary | |
---|---|
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
|
Fields inherited from class org.codehaus.plexus.util.FileUtils |
---|
FS, ONE_GB, ONE_KB, ONE_MB |
Constructor Summary | |
---|---|
FileUtils()
|
Method Summary | |
---|---|
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 |
Methods inherited from class org.codehaus.plexus.util.FileUtils |
---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public FileUtils()
Method Detail |
---|
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 output
IOException
- exception if there is an error during the deletionpublic static void deleteFile(String strFolderPath, String strFileName) throws IOException
strFolderPath
- the folder pathstrFileName
- the file name
IOException
- exception if there is an error during the deletionpublic static String readLastLine(String strFile)
strFile
- the file absolute path (ex : /home/filetopath/file.txt)
public static void writeToFile(String strContent, String strFile)
strContent
- the content to writestrFile
- the file
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |