diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-06-07 19:56:20 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-06-07 19:56:20 +0000 |
commit | 9e8a4944e50fab432012878c66e1bdac20649f76 (patch) | |
tree | 412b0d49ae4086bb330045f9956513397b866807 /src/tests | |
parent | c2e3879b965d297604804f03271ac71c8c5c81f3 (diff) | |
download | libbu++-9e8a4944e50fab432012878c66e1bdac20649f76.tar.gz libbu++-9e8a4944e50fab432012878c66e1bdac20649f76.tar.bz2 libbu++-9e8a4944e50fab432012878c66e1bdac20649f76.tar.xz libbu++-9e8a4944e50fab432012878c66e1bdac20649f76.zip |
The Stream Filter archetecture is finished, it's actually much cooler than I
had anticipated, and much cleaner. I'll have to add some documentation to it,
because it's not really obvious how any of it fits together from the outset,
although I have to say that the bzip2 test program is the easiest general bzip2
compression program I've ever made...it just goes :)
Decompression in Bu::BZip2 isn't finished yet, but that's ok, it's coming soon.
Diffstat (limited to '')
-rw-r--r-- | src/tests/bzip2.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tests/bzip2.cpp b/src/tests/bzip2.cpp new file mode 100644 index 0000000..683d3d7 --- /dev/null +++ b/src/tests/bzip2.cpp | |||
@@ -0,0 +1,23 @@ | |||
1 | #include "bu/bzip2.h" | ||
2 | #include "bu/file.h" | ||
3 | |||
4 | int main( int argc, char *argv[] ) | ||
5 | { | ||
6 | char buf[1024]; | ||
7 | size_t nRead; | ||
8 | |||
9 | Bu::File f( "test.bz2", "wb" ); | ||
10 | Bu::BZip2 bz2( f ); | ||
11 | |||
12 | Bu::File fin( argv[1], "rb"); | ||
13 | |||
14 | for(;;) | ||
15 | { | ||
16 | nRead = fin.read( buf, 1024 ); | ||
17 | if( nRead > 0 ) | ||
18 | bz2.write( buf, nRead ); | ||
19 | if( fin.isEOS() ) | ||
20 | break; | ||
21 | } | ||
22 | } | ||
23 | |||