46 , mnInBufSize(nInBufSize)
49 , mnOutBufSize(nOutBufSize)
50 , mnUncompressedSize(0)
52 , mnLastModifiedTime(0)
67 sal_uInt64 nCurPos = rIStm.
Tell();
69 sal_uInt16 nFirstTwoBytes = 0;
71 rIStm.
Seek( nCurPos );
85 pStream->total_out = pStream->total_in = 0;
88 pStream->zalloc =
nullptr;
89 pStream->zfree =
nullptr;
90 pStream->opaque =
nullptr;
91 pStream->avail_out = pStream->avail_in = 0;
109 while ( deflate( pStream, Z_FINISH ) != Z_STREAM_END );
114 retvalue = pStream->total_in;
115 deflateEnd( pStream );
138 retvalue = pStream->total_out;
139 inflateEnd( pStream );
164 auto pStream =
static_cast<z_stream*
>(
mpsC_Stream);
167 pStream->next_in =
mpInBuf.get();
169 if (pStream->avail_in == 0)
171 if ( pStream->avail_out == 0 )
173 if ( deflate( pStream, Z_NO_FLUSH ) < 0 )
185 auto pStream =
static_cast<z_stream*
>(
mpsC_Stream);
200 pStream->next_in =
mpInBuf.get();
204 err =
mbStatus ? inflate(pStream, Z_NO_FLUSH) : Z_ERRNO;
205 if (
err < 0 ||
err == Z_NEED_DICT)
212 while ( (
err != Z_STREAM_END) && ( pStream->avail_in ||
mnInToRead ) );
227 auto pStream =
static_cast<z_stream*
>(
mpsC_Stream);
228 pStream->avail_in = nSize;
229 pStream->next_in =
pData;
231 while ( pStream->avail_in || ( pStream->avail_out == 0 ) )
233 if ( pStream->avail_out == 0 )
236 if ( deflate( pStream, Z_NO_FLUSH ) < 0 )
256 auto pStream =
static_cast<z_stream*
>(
mpsC_Stream);
257 pStream->avail_out = nSize;
258 pStream->next_out =
pData;
264 pStream->next_in =
mpInBuf.get();
268 err =
mbStatus ? inflate(pStream, Z_NO_FLUSH) : Z_ERRNO;
269 if (
err < 0 ||
err == Z_NEED_DICT)
276 while ( (
err != Z_STREAM_END) &&
277 (pStream->avail_out != 0) &&
279 if (
err == Z_STREAM_END )
287 auto pStream =
static_cast<z_stream*
>(
mpsC_Stream);
310 auto pStream =
static_cast<z_stream*
>(
mpsC_Stream);
313 Z_DEFAULT_STRATEGY, ZLIB_VERSION,
sizeof (z_stream)) >= 0;
322 auto pStream =
static_cast<z_stream*
>(
mpsC_Stream);
326 sal_uInt16 nFirstTwoBytes;
333 if ( nMethod != Z_DEFLATED )
353 while ( j && !inStream.
eof() );
362 while ( j && !inStream.
eof() );
368 mbStatus = inflateInit2( pStream, -MAX_WBITS) == Z_OK;
372 mbStatus = ( inflateInit( pStream ) >= 0 );
382 sal_uInt64 nStreamPos = rIStm.
Tell();
388 rIStm.
Seek(nStreamPos);
391 rIStm.
Seek(nStreamPos);
397 rIStm.
Seek(nStreamPos);
400 rIStm.
Seek(nStreamPos);
virtual sal_uInt64 TellEnd()
std::size_t WriteBytes(const void *pData, std::size_t nSize)
bool eof() const
end of input seen during previous i/o operation
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
SvStream & WriteUInt8(sal_uInt8 nuInt8)
sal_uInt64 Seek(sal_uInt64 nPos)
std::size_t ReadBytes(void *pData, std::size_t nSize)
sal_uInt64 SeekRel(sal_Int64 nPos)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
SvStream & ReadUChar(unsigned char &rChar)
tools::Long Decompress(SvStream &rIStm, SvStream &rOStm)
tools::Long Read(SvStream &rIStm, sal_uInt8 *pData, sal_uInt32 nSize)
bool AttemptDecompression(SvStream &rIStm, SvStream &rOStm)
void InitDecompress(SvStream &inStream)
sal_uInt32 mnLastModifiedTime
void SetCompressionMetadata(const OString &sFilename, sal_uInt32 nLastModifiedTime, sal_uInt32 nInBufCRC32)
Set metadata for gzlib compression.
static bool IsZCompressed(SvStream &rIStm)
Checks whether a stream is Z compressed.
ZCodec(size_t nInBufSize=32768, size_t nOutBufSize=32768)
tools::Long EndCompression()
sal_uInt32 mnUncompressedSize
void BeginCompression(int nCompressLevel=ZCODEC_DEFAULT_COMPRESSION, bool gzLib=false)
void Write(SvStream &rOStm, const sal_uInt8 *pData, sal_uInt32 nSize)
std::unique_ptr< sal_uInt8[]> mpInBuf
std::unique_ptr< sal_uInt8[]> mpOutBuf
void Compress(SvStream &rIStm, SvStream &rOStm)
std::unique_ptr< sal_Int32[]> pData
#define STREAM_SEEK_TO_END
constexpr sal_uInt8 GZ_EXTRA_FIELD
constexpr sal_uInt8 GZ_COMMENT
constexpr sal_uInt8 GZ_DEFLATE
constexpr sal_uInt8 GZ_RESERVED
constexpr sal_uInt8 GZ_ORIG_NAME
constexpr sal_uInt8 GZ_HEAD_CRC
constexpr sal_uInt8 GZ_FS_UNKNOWN
constexpr sal_uInt16 GZ_MAGIC_BYTES_LE
#define ZCODEC_DEFAULT_COMPRESSION