From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d4db,1aa87b92879e463,start X-Google-Attributes: gid10d4db,public X-Google-ArrivalTime: 2002-07-06 23:45:21 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.alt.net!cola.stump.algebra.com!robomod!not-for-mail From: Aaron Isotton Newsgroups: comp.os.linux.announce Subject: GPL: bz2stream 0.1.0 Date: 7 Jul 2002 06:45:21 GMT Organization: [Infostrada] Message-ID: <87y9cpve6k.fsf@isotton.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-Path: X-COLA-Policy: http://stump.algebra.com/~cola X-COLA-Info-1: Send submissions to cola@stump.algebra.com X-COLA-Info-2: Send complaints to cola-admin@stump.algebra.com X-Comment: moderators do not necessarily agree or disagree with this article. X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov) User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter) X-Complaints-To: abuse@inwind.it X-Trace: twister1.libero.it 1025968133 62.98.56.177 (Sat, 06 Jul 2002 17:08:53 MET DST) NNTP-Posting-Date: Sat, 06 Jul 2002 17:08:53 MET DST X-Auth: PGPMoose V1.1 PGP comp.os.linux.announce iQBVAwUAPSfi0SFvAtx2nXvNAQGkdwIAjvM7gfx3deZRVw7/192jPt2p8wWgQ9pF PB2FoDBYNsM7scjLQ/0s1IGSsBKDcWqGJ4cSaJah3GTrKYnx0W+2Kg== =zfJa Xref: archiver1.google.com comp.os.linux.announce:2299 I'm happy to announce the first release (0.1.0) of bz2stream, a set of C++ stream classes wrapping libbzip2. The streams do not write the data to any default destination, but to another stream buffer. This gives you the maximun possible flexibility. You just create a "normal" input or output stream, and then use pass its stream buffer to the bz2 stream. The bz2 stream acts as a filter, compressing or decompressing all the data you pass it. For example, to read in a file and compress it to another file, a program as the following would be enough: #include "bz2stream.hpp" #include #include int main(int argc, char** argv) { std::ifstream infile(argv[1], std::ios::binary); std::ofstream outfile(argv[2], std::ios::binary); bz2ostream out(outfile.rdbuf()); out << infile.rdbuf(); } The performance loss because of the use of the stream classes and not of direct calls to libbzip2's API is virtually non existant. This program is as fast as bzip2. The use of the bz2 stream classes is especially easy because there are no libraries you need to link to; you only need to include the bz2stream.hpp header. (Of course you must link against libbz2). This is an early release; this code is tested, but not ready for applications where absolute reliability is a must. bz2stream is available at http://www.isotton.com/bz2stream/. It is released under the GNU GPL and includes HTML documentation. Aaron Isotton http://www.isotton.com/ My GPG public key: http://www.isotton.com/gpg-public-key ########################################################################## # Send submissions for comp.os.linux.announce to: cola@stump.algebra.com # # PLEASE remember a short description of the software and the LOCATION. # # This group is archived at http://stump.algebra.com/~cola/ # ##########################################################################