|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object base.util.FileUtil
public class FileUtil
This class provides some basic methods to manage files and folders.
Constructor Summary | |
---|---|
FileUtil()
|
Method Summary | |
---|---|
static java.io.File[] |
allFileContent(java.io.File file)
This method builds an array of files. |
static boolean |
checkCRC32Checksum(java.io.File file,
java.lang.Long crc32Checksum)
This method checks if the computed CRC32 Checksum of the input file is equals to the provided crc32Checksum passed as formal argument. |
static boolean |
checkMD5Digest(java.io.File file,
java.lang.String md5Digest)
This method checks if the computed MD5 Digest of the input file is equals to the provided md5Digest passed as formal argument. |
static void |
copyFile(java.io.File input,
java.io.File output)
|
static java.lang.Long |
createCRC32Checksum(java.io.File file)
This method creates a CRC32 Checksum relative to the file passed as formal parameter. |
static java.lang.String |
createMD5Digest(java.io.File file)
This method builds an MD5 Digest of a provided input file. |
static boolean |
deleteDirectory(java.io.File directory)
Deletes all files and subdirectories under directory. |
static java.lang.String |
fileContent(java.io.File file)
This method reads all the lines of the input file returning its content in form of a String. |
static long |
fileSizeInByte(java.io.File file)
This method computes the specified file occupied space on the HD. |
static long |
fileSizeInGB(java.io.File file)
This method computes the specified file occupied space on the HD. |
static long |
fileSizeInKB(java.io.File file)
This method computes the specified file occupied space on the HD. |
static long |
fileSizeInMB(java.io.File file)
This method computes the specified file occupied space on the HD. |
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 long fileSizeInByte(java.io.File file)
file
- The file or directory whose size must be computed.
public static long fileSizeInKB(java.io.File file)
file
- The file or directory whose size must be computed.
public static long fileSizeInMB(java.io.File file)
file
- The file or directory whose size must be computed.
public static long fileSizeInGB(java.io.File file)
file
- The file or directory whose size must be computed.
public static java.lang.Long createCRC32Checksum(java.io.File file) throws java.io.IOException
file
- The file whose checksum must be created.
java.io.IOException
- If can't be created the InputStream associated to the input
File.public static boolean checkCRC32Checksum(java.io.File file, java.lang.Long crc32Checksum) throws java.io.IOException
file
- The file whose checksum must be compared with the input
crc32Checksum.crc32Checksum
- The comparation parameter.
java.io.IOException
- If can't be created the InputStream associated to the input
File.public static java.io.File[] allFileContent(java.io.File file)
file
- The file or folder from which the resultant array is built.
public static boolean deleteDirectory(java.io.File directory)
directory
- The directory that must be deleted.
public static java.lang.String createMD5Digest(java.io.File file) throws java.io.IOException
file
- The file whose MD5 Digest must be build.
java.io.IOException
- If the method can't use the filesystem or the provided file
doesn't exists.public static boolean checkMD5Digest(java.io.File file, java.lang.String md5Digest) throws java.io.IOException
file
- The file whose md5 digest must be compared with the input
md5Digest.md5Digest
- The comparation parameter.
java.io.IOException
- If can't be created the InputStream associated to the input
File.public static java.lang.String fileContent(java.io.File file) throws java.io.IOException
file
- The file whose content must be retrieved.
java.io.IOException
- If can't work on the filesystem.public static void copyFile(java.io.File input, java.io.File output) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |