解压tar包工具UntarUtil(2)
2009-11-05 15:09
225 查看
/**
* 解压
* @param fileUtils 文件对象
* @param srcF 源文件
* @param dir 目录
* @see Expand#expandFile(FileUtils, File, File)
* @throws IOException 抛出IO异常
*/
protected void expandFile(FileUtils fileUtils, File srcF, File dir)
throws IOException
{
FileInputStream fis = null;
TarInputStream tis = null;
try
{
fis = new FileInputStream(srcF);
tis = new TarInputStream(compression.decompress(srcF,
new BufferedInputStream(fis)));
TarEntry te = null;
while ((te = tis.getNextEntry()) != null)
{
extractFile(fileUtils,
srcF,
dir,
tis,
te.getName(),
te.getModTime(),
te.isDirectory());
}
}
finally
{
if (tis != null)
{
tis.close();
}
if (fis != null)
{
fis.close();
}
}
}
* 解压
* @param fileUtils 文件对象
* @param srcF 源文件
* @param dir 目录
* @see Expand#expandFile(FileUtils, File, File)
* @throws IOException 抛出IO异常
*/
protected void expandFile(FileUtils fileUtils, File srcF, File dir)
throws IOException
{
FileInputStream fis = null;
TarInputStream tis = null;
try
{
fis = new FileInputStream(srcF);
tis = new TarInputStream(compression.decompress(srcF,
new BufferedInputStream(fis)));
TarEntry te = null;
while ((te = tis.getNextEntry()) != null)
{
extractFile(fileUtils,
srcF,
dir,
tis,
te.getName(),
te.getModTime(),
te.isDirectory());
}
}
finally
{
if (tis != null)
{
tis.close();
}
if (fis != null)
{
fis.close();
}
}
}
相关文章推荐
- 解压tar包工具UntarUtil(1)
- 解压tar包工具UntarUtil(3)
- 解压tar包工具UntarUtil(4)
- shell脚本中if与case使用,查找文件locate与find的使用,压缩,解压及归档工具
- ssh client files transfer工具开启过慢,winrar工具点击解压到反应过慢
- 不用解压工具在windows下解压bz2
- C#第三方zip解压压缩工具,带事例源码
- Linux 安装rar解压工具
- javascript 在线压缩和解压工具
- unity 实现另一个unity软件的安装工具(3)——压缩解压安装工程
- 常用工具说明--mongodb、mysql解压版、IDEA配置maven
- Ubuntu 安装rar压缩、解压工具
- Linux 下的自解压工具
- [C语言] 文件操作,解压华为官方固件UNDATE.APP工具(源代码);
- 不用第三方工具解压zip档案
- ruby利用Zip Gem写一个简单的压缩和解压的小工具
- VMware Tools工具安装不能解压问题
- 打tar包工具TarUtil(6)
- 打tar包工具TarUtil(13)
- 一款集JS格式化,JS压缩,解压,CSS格式化,压缩的工具整合