From da1e0ef0772b078bd295301bd675afdee00d40e9 Mon Sep 17 00:00:00 2001
From: Mike Buland <eichlan@xagasoft.com>
Date: Sun, 23 Oct 2011 07:43:50 +0000
Subject: Switched ito* to synchro*, except the server, I'm thinking of takeing
 the core in a different direction anyway.

Added the Deflate class, it uses zlib, and can do raw (headerless) deflate
streams, zlib format, or gzip format.  It's easy to use and quite versitile.
---
 src/tests/deflate.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 src/tests/deflate.cpp

(limited to 'src/tests')

diff --git a/src/tests/deflate.cpp b/src/tests/deflate.cpp
new file mode 100644
index 0000000..9796408
--- /dev/null
+++ b/src/tests/deflate.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
+ *
+ * This file is part of the libbu++ library and is released under the
+ * terms of the license contained in the file LICENSE.
+ */
+
+#include "bu/deflate.h"
+#include "bu/file.h"
+
+int main( int argc, char *argv[] )
+{
+	if( argc < 3 )
+	{
+		printf("usage:  %s <in> <out>\n", argv[0] );
+		return -1;
+	}
+
+	char buf[1024];
+	size_t nRead;
+
+	/*
+	Bu::File fin( argv[1], Bu::File::Read );
+	fin.seek( 4 );
+	Bu::Deflate def( fin );
+	
+	Bu::File f( argv[2], Bu::File::WriteNew );
+
+	for(;;)
+	{
+		nRead = def.read( buf, 1024 );
+		if( nRead > 0 )
+			f.write( buf, nRead );
+		if( def.isEos() )
+			break;
+	}
+	*/
+
+	Bu::File fin( argv[1], Bu::File::Read );
+	
+	Bu::File f( argv[2], Bu::File::WriteNew );
+	Bu::Deflate def( f, 9, Bu::Deflate::Gzip );
+
+	for(;;)
+	{
+		nRead = fin.read( buf, 1024 );
+		if( nRead > 0 )
+			def.write( buf, nRead );
+		if( fin.isEos() )
+			break;
+	}
+}
+
-- 
cgit v1.2.3