ZlibCompressed::ZlibCompressed(Base &b, unsigned level):
- below(b),
- buffer_size(1024),
- in_buffer(0),
- out_buffer(0),
- stream_end(false),
- priv(0)
+ below(b)
{
-#ifdef WITH_ZLIB
mode = below.get_mode()&M_RDWR;
if(mode!=M_READ && mode!=M_WRITE)
throw invalid_access(mode);
+ init(level);
+}
+
+ZlibCompressed::ZlibCompressed(Base &b, Mode m, unsigned level):
+ below(b)
+{
+ mode = m&below.get_mode()&M_RDWR;
+ if(mode!=M_READ && mode!=M_WRITE)
+ throw invalid_access(m);
+
+ init(level);
+}
+
+void ZlibCompressed::init(unsigned level)
+{
+#ifdef WITH_ZLIB
+ buffer_size = 1024;
+ in_buffer = 0;
+ out_buffer = 0;
+ stream_end = false;
priv = new Private;
if(mode==M_WRITE)