如何在Java中列出压缩tar文件的内容 [英] How to list the contents of a compressed tar file in Java

查看:236
本文介绍了如何在Java中列出压缩tar文件的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不提取文件的情况下在Java中列出压缩tar文件的内容?我看过apache ant api,我可以看到如何提取文件,但我无法弄清楚如何只列出它们。 tar文件是bz2或gz。

How do I list the contents of a compressed tar file in Java without extracting the files? I have looked at apache ant api, and I can see how to extract files, but I cannot work out how to just list them. The tar files are either bz2 or gz.

推荐答案

我建议使用 TrueZIP 确实好。


TrueZIP是一个虚拟文件系统框架和一个用于访问存档文件的库,就好像它们只是普通的旧目录。

TrueZIP is a framework for virtual file systems and a library for accessing archive files as if they were just plain old directories.

作为一个框架,TrueZIP提供了接口和类来编写插件到其联合文件系统空间的文件系统驱动程序。

As a framework, TrueZIP provides the interfaces and classes to write file system drivers which plug-in to its federated file system space.

作为一个库,TrueZIP提供了对存档文件的方便的多线程读/写访问,就好像它们只是文件系统路径中的普通旧目录一样。

As a library, TrueZIP provides convenient multi-threaded read/write access to archive files as if they were just plain old directories in a file system path.

这是一个优秀,快速的库。它有 TAR驱动程序可以处理 *。tar.gz *。tar.bz2 文件。 JavaDocs是清晰和完整的,虽然我发现独立的教程不够 - 我必须阅读JavaDoc以使工作正常。

It's an excellent, fast library. It has TAR drivers, and can handle *.tar.gz and *.tar.bz2 files. The JavaDocs are clear and complete, though I found the standalone tutorials insufficient - I had to read the JavaDoc to get things working.

...这使我成为唯一的我找到了一个缺点:可能需要一点时间来绕过TrueZIP。最初,我遇到了一些问题,但是在一段时间后它点击了,我没有更多的困难。

...Which brings me to the only downside I found: it might take a little while to wrap your head around TrueZIP. Initially, I had issues getting anything to work, but it "clicked" after a little while and I had no more difficulties.

这篇关于如何在Java中列出压缩tar文件的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆