/*
*
* Copyright (c) 1997
* Christian Michelsen Research AS
* Advanced Computing
* Fantoftvegen 38, 5036 BERGEN, Norway
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Christian Michelsen Research AS makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*/
#ifndef ZSTREAM__H
#define ZSTREAM__H
/*
* zstream.h - C++ interface to the 'zlib' general purpose compression library
* $Id$
*/
#include <strstream.h>
#include <string.h>
#include <stdio.h>
#include "zlib.h"
#if defined(_WIN32)
# include <fcntl.h>
# include <io.h>
#else
#endif
};
// ----------------------------- izstream -----------------------------
{
/* Opens a gzip (.gz) file for reading.
* open() can be used to read a file which is not in gzip format;
* in this case read() will directly read from the file without
* decompression. errno can be checked to distinguish two error
* cases (if errno is zero, the zlib error is Z_MEM_ERROR).
*/
}
}
/* Flushes all pending input if necessary, closes the compressed file
* and deallocates all the (de)compression state. The return value is
* the zlib error number (see function error() below).
*/
int close() {
m_fp = 0; return r;
}
/* Binary read the given number of bytes from the compressed file.
*/
}
/* Returns the error message for the last error which occurred on the
* given compressed file. errnum is set to zlib error number. If an
* error occurred in the file system and not in the compression library,
* errnum is set to Z_ERRNO and the application may consult errno
* to get the exact error code.
*/
}
};
/*
* Binary read the given (array of) object(s) from the compressed file.
* If the input file was not in gzip format, read() copies the objects number
* of bytes into the buffer.
* returns the number of uncompressed bytes actually read
* (0 for end of file, -1 for error).
*/
}
/*
* Binary input with the '>' operator.
*/
return zs;
}
}
/*
* Read length of string + the string with the '>' operator.
*/
return zs;
}
return x;
}
// ----------------------------- ozstream -----------------------------
{
}
}
}
~ozstream() {
close();
}
/* Opens a gzip (.gz) file for writing.
* The compression level parameter should be in 0..9
* errno can be checked to distinguish two error cases
* (if errno is zero, the zlib error is Z_MEM_ERROR).
*/
}
/* open from a FILE pointer.
*/
}
/* Flushes all pending output if necessary, closes the compressed file
* and deallocates all the (de)compression state. The return value is
* the zlib error number (see function error() below).
*/
int close() {
if (m_os) {
}
}
/* Binary write the given number of bytes into the compressed file.
*/
}
/* Flushes all pending output into the compressed file. The parameter
* _flush is as in the deflate() function. The return value is the zlib
* error number (see function gzerror below). flush() returns Z_OK if
* the flush_ parameter is Z_FINISH and all output could be flushed.
* flush() should be called only when strictly necessary because it can
* degrade compression.
*/
os_flush();
}
/* Returns the error message for the last error which occurred on the
* given compressed file. errnum is set to zlib error number. If an
* error occurred in the file system and not in the compression library,
* errnum is set to Z_ERRNO and the application may consult errno
* to get the exact error code.
*/
}
return *m_os;
}
void os_flush() {
}
}
};
/*
* Binary write the given (array of) object(s) into the compressed file.
* returns the number of uncompressed bytes actually written
* (0 in case of error).
*/
}
/*
* Binary output with the '<' operator.
*/
return zs;
}
}
/*
* Write length of string + the string with the '<' operator.
*/
return zs;
}
#ifdef _MSC_VER
return zs < (const char*) x;
}
#endif
/*
* Ascii write with the << operator;
*/
}
#endif