|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.mojo.license.FileUtil
public class FileUtil
Some basic file io utilities
Constructor Summary | |
---|---|
FileUtil()
|
Method Summary | |
---|---|
static void |
backupFile(File f)
Backups the given file using the getBackupFile(File) as
destination file. |
static void |
copyFile(File source,
File target)
Copy a file to a given locationand logging. |
static boolean |
createDirectoryIfNecessary(File dir)
Creates the directory (and his parents) if necessary. |
static boolean |
createNewFile(File file)
|
static void |
deleteFile(File file)
Delete the given file. |
static File |
getBackupFile(File file)
|
static File |
getFile(File base,
String... paths)
|
static String |
readAsString(File file,
String encoding)
Permet de lire un fichier et de retourner sont contenu sous forme d'une chaine de carateres |
static void |
renameFile(File file,
File destination)
Rename the given file to a new destination. |
static void |
tryClose(InputStream is)
|
static void |
tryClose(OutputStream os)
|
static void |
writeString(File file,
String content,
String encoding)
Sauvegarde un contenu dans un fichier. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileUtil()
Method Detail |
---|
public static void tryClose(InputStream is)
public static void tryClose(OutputStream os)
public static boolean createDirectoryIfNecessary(File dir) throws IOException
dir
- the directory to create if not exisiting
true
if directory was created, false
if was no
need to create it
IOException
- if could not create directorypublic static boolean createNewFile(File file) throws IOException
IOException
public static void deleteFile(File file) throws IOException
file
- the file to delete
IOException
- if could not delete the filepublic static void renameFile(File file, File destination) throws IOException
file
- the file to renamedestination
- the destination file
IOException
- if could not rename the filepublic static void copyFile(File source, File target) throws IOException
source
- represents the file to copy.target
- file name of destination file.
IOException
- if could not copy file.public static File getFile(File base, String... paths)
public static File getBackupFile(File file)
file
- the source file
public static void backupFile(File f) throws IOException
getBackupFile(File)
as
destination file.
f
- the file to backup
IOException
- if any pb while copying the filepublic static String readAsString(File file, String encoding) throws IOException
file
- le fichier a lireencoding
- encoding to read file
IOException
- if IO pbpublic static void writeString(File file, String content, String encoding) throws IOException
file
- le fichier a ecrirecontent
- le contenu du fichierencoding
- l'encoding d'ecriture
IOException
- if IO pb
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |