Package org.codehaus.mojo.license.utils
Class FileUtil
java.lang.Object
org.codehaus.mojo.license.utils.FileUtil
Some basic file io utilities
- Since:
- 1.0
- Author:
- pgier, tchemit dev@tchemit.fr
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbackupFile(File f) Backups the given file using thegetBackupFile(File)as destination file.static voidCopy a file to a given locationand logging.static FilegetBackupFile(File file) orderFiles(Collection<File> files) static voidprintString(File file, String content, String encoding) Print content to file.static voidrenameFile(File file, File destination) Rename the given file to a new destination.static Stringstatic StringtoExtension(String mimeType, boolean throwDefault)
-
Constructor Details
-
FileUtil
public FileUtil()
-
-
Method Details
-
renameFile
Rename the given file to a new destination.- Parameters:
file- the file to renamedestination- the destination file- Throws:
IOException- if could not rename the file
-
copyFile
Copy a file to a given locationand logging.- Parameters:
source- represents the file to copy.target- file name of destination file.- Throws:
IOException- if could not copy file.
-
getBackupFile
- Parameters:
file- the source file- Returns:
- the backup file
-
backupFile
Backups the given file using thegetBackupFile(File)as destination file.- Parameters:
f- the file to backup- Throws:
IOException- if any pb while copying the file
-
printString
Print content to file. This method ensures that a platform specific line ending is used.- Parameters:
file- the file to write tocontent- the content to writeencoding- the encoding to write in- Throws:
IOException- if IO pb
-
orderFiles
-
sha1
- Throws:
IOException
-
toExtension
-