问题标签 [bzip2]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
7000 浏览

c++ - 如何在 C++ 中使用 libbz2 压缩目录

我需要创建一个目录的 tarball,然后在 C++ 中使用 bz2 对其进行压缩。有没有关于使用 libtar 和 libbz2 的不错的教程?

0 投票
2 回答
2087 浏览

archive - 只解压特定的 bzip2 块

假设我有一个 bzip2 文件(超过 5GB),我只想解压缩块 #x,因为我的数据在哪里(块每次都不同)。我该怎么做?

我考虑过对所有块的位置进行索引,然后从文件中剪切我需要的块并将 bzip2recover 应用于它。

我还考虑过一次压缩 1MB,然后将其附加到文件中(并记录位置),并在需要时简单地抓取文件,但我宁愿保持原始 bzip2 文件完好无损。

我的首选语言是 Ruby,但任何语言的解决方案我都可以(只要我了解原理)。

0 投票
2 回答
1695 浏览

java - 将文件数据作为 Bzip2 写入 servlet 响应的输出

我正在尝试让 Tomcat 将 servlet 内容写为 bzip2 文件(可能是愚蠢的要求,但对于某些集成工作显然是必要的)。我正在使用 Spring 框架,所以它位于 AbstractController 中。

我正在使用来自 http://www.kohsuke.org/bzip2/的 bzip2 库

我可以很好地将内容 bzip 压缩,但是当文件被写出时,它似乎包含一堆元数据并且无法识别为 bzip2 文件。

这就是我正在做的

这是从 Spring abstractcontroller 中的以下方法调用的

我用不同的方法尝试了一些方法,包括直接写入 ServletOutput,但我很困惑,在网上找不到任何/很多示例。

以前遇到过这种情况的任何人的任何建议都将不胜感激。替代库/方法很好,但不幸的是它必须是 bzip2'd。

0 投票
2 回答
18622 浏览

java - 解压缩 BZIP2 存档

我可以解压缩 zip、gzip 和 rar 文件,但我还需要解压缩 bzip2 文件以及解压缩它们 (.tar)。我还没有遇到一个好的图书馆来使用。

我非常理想地使用 Java 和 Maven,我想将它作为依赖项包含在 POM 中。

你推荐什么图书馆?

0 投票
1 回答
1280 浏览

php - PHP Bz2 扩展问题

当我使用时bzopen,我是否需要bzwrite()已经被一个bzcompress()字符串压缩或者它是在写入时自动压缩的?

0 投票
1 回答
2073 浏览

c++ - BOOST.IOstreams:写入 bzip2 的麻烦

您好,我想使用 Boost.IOstreams 将我的数据存储到 bzip2 文件中。

我做错了什么?我正在使用提升 1.42.0。

亲切的问候阿尔曼。

编辑 如果我删除双向选项,代码就可以工作:

也许有人可以解释为什么?

0 投票
2 回答
2711 浏览

c++ - boost::iostreams::copy() 的异常

在下面的代码中,我有一个损坏的“hello.bz2”,其中有超出 EOF 的杂散字符。

有没有办法让 boost::iostreams::copy() 调用 throw ?

编辑:请忽略迄今为止最受关注的行;EOF。请假设使用损坏的 bzip2 文件。我使用“EOF”提示我在文件上运行 bzcat 时遇到的错误

0 投票
4 回答
2704 浏览

compression - 如何合并 2 个 bzip2 文件?

我想合并 2 个 bzip2 文件。我尝试将一个附加到另一个:cat file1.bzip2 file2.bzip2 > out.bzip2这似乎有效(此文件已正确解压缩),但我想将此文件用作 Hadoop 输入文件,并且我收到有关损坏块的错误。

合并 2 个 bzip2 文件而不解压缩它们的最佳方法是什么?

0 投票
2 回答
1182 浏览

python - 使用 python 脚本的 multicpu bzip2

我想使用我的 8 核 16 GB ram 工作站快速 bzip2 压缩数百 GB 的数据。目前我正在使用一个简单的 python 脚本来压缩整个目录树,它使用 bzip2 和一个耦合到 os.walk 调用的 os.system 调用。

我看到 bzip2 只使用一个 cpu,而另一个 cpu 保持相对空闲。

我是队列和线程进程的新手。但我想知道如何实现这一点,以便我可以有四个 bzip2 运行线程(实际上我猜是 os.system 线程),每个线程可能使用自己的 cpu ,当他们 bzip 文件时从队列中耗尽文件。

我的单线程脚本粘贴在这里。

0 投票
2 回答
959 浏览

python - Organizing files in tar bz2 file with python

I have about 200,000 text files that are placed in a bz2 file. The issue I have is that when I scan the bz2 file to extract the data I need, it goes extremely slow. It has to look through the entire bz2 file to fine the single file I am looking for. Is there anyway to speed this up?

Also, I thought about possibly organizing the files in the tar.bz2 so I can instead have it know where to look. Is there anyway to organize files that are put into a bz2?

More Info/Edit: I need to query the compressed file for each textfile. Is there a better compression method that supports such a large number of files and is as thoroughly compressed?