1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hgzip.h,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 /* $Id: hgzip.h,v 1.5 2008-06-04 09:57:59 vg Exp $ */
36 // DVO: add zlib/ prefix
40 #include "zlib/zlib.h"
45 * @short Structure for using z_stream
51 * The error code of z_stream operation
55 * EOF of the input file
61 HStream
* _inputstream
;
71 * Crc32 of uncompressed data
79 * It becomes one when the input file type is not gz file
89 * Opens a gzipped stream for reading.
90 * gz_open returns NULL if the stream could not be opened or if there was
91 * insufficient memory to allocate the (de)compression state; errno
92 * can be checked to distinguish the two cases (if errno is zero, the
93 * zlib error is Z_MEM_ERROR).
94 * @param _stream Reference of stream object having binary data.
96 gz_stream
*gz_open ( HStream
& _stream
);
98 * Flushes all pending output if necessary, closes the compressed stream
99 * and deallocates all the (de)compression state
101 int gz_close ( gz_stream
*file
);
103 * Reads the given number of uncompressed bytes from the compressed stream
104 * @param file Gzipped stream
105 * @param buf Buffer to have the data to be read
106 * @param len Length of data to be read
107 * @returns The number of bytes actually read
109 int gz_read ( gz_stream
*file
, voidp buf
, unsigned len
);
111 * Flushes all pending output into the compressed file
112 * gz_flush should be called only when strictly necessary because it can
113 * degrade compression
114 * @param flush Is as in the deflate() function
116 int gz_flush ( gz_stream
*file
, int flush
);
117 #endif /* _HWPGZIP_H_ */