|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ChinaVO.FITSManager.Util.FileUtil
public class FileUtil
some utilitiy functions for file operation.
Constructor Summary | |
---|---|
FileUtil()
|
Method Summary | |
---|---|
static java.lang.String |
fileSize2String(long len)
Format a filesize with unit B,KB,MB,GB,TB. |
static java.lang.String |
getFileCRC32String(java.io.File f)
Return a file's CRC32 string. |
static java.lang.String |
getFileMD5String(java.io.File f)
Get a file's md5 string. |
static java.lang.String |
getFileSuffix(java.io.File f)
Find the last '.' of the file's filename, and return the suffix string. |
static boolean |
gzip(java.io.File f,
java.io.File out)
Compress a file to a gz file. |
static boolean |
isSystemFile(java.io.File f)
In windows OS,according to the FileSystemView.getSystemTypeDescription(), if a file's type is "System Folder", return true, else return false. |
static java.lang.String |
path2URL(java.lang.String strPath,
java.lang.String protocol)
encoding the file path to be an URL. exmaple:FileUtil.path2URL("D:/fits files/1.fit","file:/") return file:/D:/ftis%20files/1.fit |
static boolean |
tar(java.io.File[] fs,
java.io.File out)
Pack files into a tar file. |
static boolean |
targz(java.io.File[] fs,
java.io.File out)
tar files in to a tar package and then compress the package by gz. |
static boolean |
zip(java.io.File[] fs,
java.io.File out)
compress files in to a zip file |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileUtil()
Method Detail |
---|
public static boolean isSystemFile(java.io.File f)
f
- a File instance.
public static java.lang.String getFileSuffix(java.io.File f)
f
- a File instance
public static java.lang.String fileSize2String(long len)
len
- a file's size by bytes.
public static java.lang.String path2URL(java.lang.String strPath, java.lang.String protocol)
strPath
- path of a fileprotocol
- the protocol used to visit the file, such as
file:/,http:/,ftp:/ etc.
public static java.lang.String getFileMD5String(java.io.File f)
f
- file instance
public static java.lang.String getFileCRC32String(java.io.File f)
f
- File instance.
public static boolean zip(java.io.File[] fs, java.io.File out)
fs
- file array(file in fs could be a folder, program will search
all sub files and sub folders in the folder)out
- the output zip file's instance
public static boolean gzip(java.io.File f, java.io.File out)
f
- file instanceout
- gz file instance
public static boolean tar(java.io.File[] fs, java.io.File out)
fs
- file arrat,include folder.out
- tar file instance
public static boolean targz(java.io.File[] fs, java.io.File out)
fs
- file array, include folder.out
- tar.gz file's instance
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |