Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
在示例中,将
compressed
替换为 new File("PATH_TO_FILE")。示例代码将产生一个输出流,我想 LzmaOutputStream 或库具有将流转换为二进制或字符串的适当方法。默认情况下,Lzma 只是一种压缩算法,而不是像 tar 或 zip 那样的文件存档器。 (注意:7-Zip 程序是一个文件存档器,但您链接到的库不支持文件遍历和解包。
我建议使用支持良好的压缩算法,如 Zip 或 gz。如果您必须使用 lzma,您可以使用tar 构建文件存档,然后使用 lzma 对其进行压缩,或者使用零压缩的 zip
这是 java TAR 库。
In the example, replace
compressed
with new File("PATH_TO_FILE"). The example code will yield an output stream, I suppose the LzmaOutputStream or the library has appropriate methods for converting the stream to binary or string.By default Lzma is only a compression algorithm, not a file archiver like tar or zip. (Note: The 7-Zip program is a file archiver, but the library you linked to does not support file traversal and unpacking.
I would suggest using a well-supporter compression algorithm like Zip or gz. If you must use lzma you could use tar to build a file archive and then compress it with lzma. Or use zip with zero compression.
Here is a java TAR library.