您的位置:首页 > 其它

解压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();

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: