bzip2

How to compress a directory with libbz2 in C++

I need to create a tarball of a directory and then compress it with bz2 in C++. Is there any decent tutorial on using libtar and libbz2? ...

Write file data as Bzip2 to output of servlet response

I'm trying to get Tomcat to write out the servlet contents as a bzip2 file (Silly requirement perhaps but it's apparently necessary for some integration work). I'm using the Spring framework so this is in an AbstractController. I'm using the bzip2 library from http://www.kohsuke.org/bzip2/ I can get the contents bzipped fine but when...

Uncompress BZIP2 archive

Hi all, I can uncompress zip, gzip, and rar files, but I also need to uncompress bzip2 files as well as unarchive them (.tar). I haven't come across a good library to use. I am using Java along with Maven so ideally, I'd like to include it as a dependency in the POM. What libraries do you recommend? Thanks, Walter ...

PHP Bz2 extension question

When I am using bzopen, do I need to bzwrite() already compressed by a bzcompress() string or is it being compressed automatically while writing? ...

BOOST.IOstreams: trouble to write to bzip2.

Hello I am would like to store my data in to bzip2 file using Boost.IOstreams. void test_bzip() { namespace BI = boost::iostreams; { string fname="test.bz2"; { BI::filtering_stream<BI::bidirectional> my_filter; my_filter.push(BI::combine(BI::bzip2_decompressor(), BI::bzip2_compressor())) ; my_filter.push(std::fstream(fna...

exceptions from boost::iostreams::copy()

In the below code, I have a corrupt "hello.bz2" which has stray characters beyond the EOF. Is there a way to make the boost::iostreams::copy() call to throw ? #include <fstream> #include <iostream> #include <boost/iostreams/filtering_streambuf.hpp> #include <boost/iostreams/copy.hpp> #include <boost/iostreams/filter/bzip2.hpp> int mai...

How to merge 2 bzip2'ed files?

Hello, I want to merge 2 bzip2'ed files. I tried appending one to another: cat file1.bzip2 file2.bzip2 > out.bzip2 which seems to work (this file decompressed correctly), but I want to use this file as a Hadoop input file, and I get errors about corrupted blocks. What's the best way to merge 2 bzip2'ed files without decompressing them? ...

multicpu bzip2 using a python script

I want to quickly bzip2 compress several hundred gigabytes of data using my 8 core , 16 GB ram workstation. Currently I am using a simple python script to compress a whole directory tree using bzip2 and an os.system call coupled to an os.walk call. I see that the bzip2 only uses a single cpu while the other cpus remain relatively idle. ...

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...

What is the fastest bzip2 decompressor?

Hello. Which implementation of bzip2 have the biggest decompression speed? There is a http://bitbucket.org/james_taylor/seek-bzip2/src/tip/micro-bunzip.c which claims Size and speed optimizations by Manuel Novoa III ([email protected]). More efficient reading of huffman codes, a streamlined read_bunzip() function, and va...

Fast memmove for x86 and +1 shift (for Move-to-front transform)

Hi For fast MTF ( http://en.wikipedia.org/wiki/Move-to-front_transform ) i need faster version of moving a char from inside the array into the front of it: char mtfSymbol[256], front; char i; for(;;) { \\ a very big loop ... i=get_i(); \\ i is in 0..256 but more likely to be smaller. front=mtfSymbol[i]; memmove(mtfS...

Mercurial Web Server - Why am I downloading a .bz2.tar file instead of a .tar.bz2 file?

It is my understanding that a .tar file contains directories and other files, and a .bz2 is a file that's compressed with bzip2 compression. Therefore, most tarballs with bzip2 compression end in: .tar.bz2 Which is bzip2 compression applied to a tarball. However, whenever I download source code from a Mercurial webserver, either the...

How do the compression codecs work in Python?

I'm querying a database and archiving the results using Python, and I'm trying to compress the data as I write it to the log files. I'm having some problems with it, though. My code looks like this: log_file = codecs.open(archive_file, 'w', 'bz2') for id, f1, f2, f3 in cursor: log_file.write('%s %s %s %s\n' % (id, f1 or 'NULL', f2...

How do I extract all the data from a bzip2 archive with C?

I have a concatenated file made up of some number of bzip2 archives. I also know the sizes of the individual bzip2 chunks in that file. I would like to decompress a bzip2 stream from an individual bzip2 data chunk, and write the output to standard output. First I use fseek to move the file cursor to the desired archive byte, and then ...

How do I handle a stream of data internal to a C-based app?

I am pulling data from a bzip2 stream within a C application. As chunks of data come out of the decompressor, they can be written to stdout: fwrite(buffer, 1, length, stdout); This works great. I get all the data when it is sent to stdout. Instead of writing to stdout, I would like to process the output from this statement internally...

PHP: I don't think I can re-compile PHP, what should I do to use the bzip2 library?

I am on shared hosting, and I noticed the PHP does not include bzip2. It seems I would have to re-compile PHP inorder to use this. I don't think shared hosting allows this, so is there any alternative to my situation or bzip2? ...