程序包 org.anyline.util
类 FileUtil
java.lang.Object
org.anyline.util.FileUtil
-
字段概要
字段修饰符和类型字段说明static final int -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static Filestatic boolean复制文件 源文件 目标文件static booleanstatic booleanstatic boolean创建文件static FilecreateTempFile(File file) static boolean删除目录static booleanstatic booleanstatic StringfetchDirByUrl(String url) 提取一个URL所在的目录static StringfetchPathByUrl(String url) 从URL中提取文件目录(删除查询参数)static byte[]static booleanfilterByType(File file, String... types) 按类型(后缀)过滤文件读取当前目录及子目录下所有子目录getAllChildrenFile(File dir, int depth, String... suffix) 读取当前目录及子目录下所有文件getAllChildrenFile(File dir, String... suffix) getChildrenFile(File dir, String... types) static StringgetFileName(File file) static StringgetFileName(String file) static String目录分隔符static StringgetFileType(byte[] b) static StringgetHostUrl(String url) 提取url根目录static intgetPathType(Class dest) 判断当前Class目录类别 0-jar包形式static intgetPathType(String path) static StringgetSimpleFileName(File file) 不含后缀的文件名static StringgetSimpleFileName(String file) static StringgetSuffixFileName(File file) static StringgetSuffixFileName(String file) getZipAllChildrenFile(File zip, String... types) ZIP文件中的所有子文件static booleanstatic booleanstatic Stringlength(long b) 文件大小格式化static int计算文件行数static String获取单个文件的MD5值!获取文件夹中文件的MD5值static void合并文件static void合并文件static String合成pathstatic StringparseSubName(File file) 识别文件类型(文件格式)static StringparseSubName(String fileName) 后缀名static Stringprogress(long total, long finish) static StringBufferstatic StringBufferstatic StringBuffer读取文件static StringBufferread(InputStream input) 读取输入流static StringBufferread(InputStream input, Charset encode) 读取输入流static StringBufferstatic voidstatic voidstatic booleansave(InputStream is, File file) 读取输入流中的数据保存至指定目录static booleansave(InputStream is, String path) 读取输入流中的数据保存至指定目录static void文件拆分static booleanwrite(InputStream is, File file) static booleanwrite(InputStream is, OutputStream os) static booleanwrite(InputStream is, OutputStream os, boolean close) static voidstatic voidstatic voidstatic voidstatic voidstatic voidstatic boolean压缩文件static boolean
-
字段详细资料
-
PATH_TYPE_JAR
public static final int PATH_TYPE_JAR- 另请参阅:
-
httpFileExtend
-
httpFileType
-
FILE_TYPE_MAP
-
-
构造器详细资料
-
FileUtil
public FileUtil()
-
-
方法详细资料
-
merge
合成path- 参数:
paths- paths- 返回:
- String
-
getFileSeparator
目录分隔符- 返回:
- String
-
getPathType
判断当前Class目录类别 0-jar包形式- 参数:
dest- dest- 返回:
- int
-
getPathType
-
read
读取输入流- 参数:
input- inputencode- encode- 返回:
- StringBuffer
-
read
读取输入流- 参数:
input- input- 返回:
- StringBuffer
-
file2byte
-
byte2file
-
read
读取文件- 参数:
file- fileencode- encode- 返回:
- StringBuffer
-
read
-
readJar
- 抛出:
IOException
-
read
-
write
- 参数:
content- 写入内容file- 文件encode- 编码append- 是否追加
-
write
-
write
-
write
-
write
-
write
-
write
-
write
-
write
-
create
创建文件- 参数:
dir- dirname- nameover- 是否清空已存在的同名文件- 返回:
- boolean
-
create
-
create
-
createTempFile
- 抛出:
Exception
-
fetchPathByUrl
从URL中提取文件目录(删除查询参数)- 参数:
url- url- 返回:
- String
-
fetchDirByUrl
提取一个URL所在的目录- 参数:
url- url- 返回:
- String
-
getHostUrl
提取url根目录- 参数:
url- url- 返回:
- String
-
getSimpleFileName
不含后缀的文件名- 参数:
file- file- 返回:
- String
-
getSimpleFileName
-
getFileName
-
getFileName
-
getSuffixFileName
-
getSuffixFileName
-
copy
复制文件 源文件 目标文件- 参数:
src- 源文件dest- 目标文件(新文件)- 返回:
- boolean
-
getAllChildrenFile
读取当前目录及子目录下所有文件- 参数:
dir- 目录depth- 目录深度 0表示根目录 1表示1级子目录 -1表示不限制深度suffix- 后缀 如果有点. 需要带上- 返回:
- List
-
getAllChildrenFile
-
getAllChildrenDirectory
读取当前目录及子目录下所有子目录- 参数:
dir- dir- 返回:
- List
-
getChildrenFile
- 参数:
dir- dirtypes- types- 返回:
- List
-
getZipAllChildrenFile
ZIP文件中的所有子文件- 参数:
zip- ziptypes- types- 返回:
- List
-
filterByType
按类型(后缀)过滤文件- 参数:
file- filetypes- types- 返回:
- boolean
-
parseSubName
后缀名- 参数:
fileName- fileName- 返回:
- String
-
exists
-
exists
-
isFile
-
isFile
-
parseSubName
识别文件类型(文件格式)- 参数:
file- file- 返回:
- String
-
getFileType
-
delete
删除目录- 参数:
file- file- 返回:
- boolean
-
lines
计算文件行数- 参数:
file- filesubbfixs- 如果file是目录, 只统计其中subbfixs结尾的文件- 返回:
- int
-
zip
压缩文件- 参数:
zip- zipsrcs- srcs- 返回:
- boolean
-
zip
-
md5
获取单个文件的MD5值!- 参数:
file- file- 返回:
- String
-
md5
获取文件夹中文件的MD5值- 参数:
file- filerecursion- true递归子目录中的文件- 返回:
- Map
-
save
读取输入流中的数据保存至指定目录- 参数:
is- 输入流file- 文件名- 返回:
- boolean
-
save
读取输入流中的数据保存至指定目录- 参数:
is- 输入流path- 文件存储目录- 返回:
- boolean
-
progress
- 参数:
total- 全部finish- 已完成- 返回:
- String
-
length
文件大小格式化- 参数:
b- b- 返回:
- String
-
merge
合并文件- 参数:
dest- 目标文件(新文件)items- items
-
merge
合并文件- 参数:
dest- dstdir- dir
-
replace
-
replace
-
split
文件拆分- 参数:
file- filecount- count
-