LibreOffice Module tools (master) 1
|
#include <zcodec.hxx>
Public Member Functions | |
ZCodec (size_t nInBufSize=32768, size_t nOutBufSize=32768) | |
~ZCodec () | |
void | BeginCompression (int nCompressLevel=ZCODEC_DEFAULT_COMPRESSION, bool gzLib=false) |
tools::Long | EndCompression () |
void | SetCompressionMetadata (const OString &sFilename, sal_uInt32 nLastModifiedTime, sal_uInt32 nInBufCRC32) |
Set metadata for gzlib compression. More... | |
void | Compress (SvStream &rIStm, SvStream &rOStm) |
tools::Long | Decompress (SvStream &rIStm, SvStream &rOStm) |
bool | AttemptDecompression (SvStream &rIStm, SvStream &rOStm) |
void | Write (SvStream &rOStm, const sal_uInt8 *pData, sal_uInt32 nSize) |
tools::Long | Read (SvStream &rIStm, sal_uInt8 *pData, sal_uInt32 nSize) |
Static Public Member Functions | |
static bool | IsZCompressed (SvStream &rIStm) |
Checks whether a stream is Z compressed. More... | |
Private Types | |
enum | State { STATE_INIT , STATE_DECOMPRESS , STATE_COMPRESS } |
Private Member Functions | |
void | InitCompress () |
void | InitDecompress (SvStream &inStream) |
void | ImplWriteBack () |
Private Attributes | |
State | meState |
bool | mbStatus |
bool | mbFinish |
std::unique_ptr< sal_uInt8[]> | mpInBuf |
size_t | mnInBufSize |
size_t | mnInToRead |
SvStream * | mpOStm |
std::unique_ptr< sal_uInt8[]> | mpOutBuf |
size_t | mnOutBufSize |
sal_uInt32 | mnUncompressedSize |
sal_uInt32 | mnInBufCRC32 |
sal_uInt32 | mnLastModifiedTime |
OString | msFilename |
int | mnCompressLevel |
bool | mbGzLib |
void * | mpsC_Stream |
Definition at line 40 of file zcodec.hxx.
|
private |
Enumerator | |
---|---|
STATE_INIT | |
STATE_DECOMPRESS | |
STATE_COMPRESS |
Definition at line 42 of file zcodec.hxx.
ZCodec::ZCodec | ( | size_t | nInBufSize = 32768 , |
size_t | nOutBufSize = 32768 |
||
) |
Definition at line 42 of file zcodec.cxx.
References mpsC_Stream.
ZCodec::~ZCodec | ( | ) |
Definition at line 59 of file zcodec.cxx.
References mpsC_Stream.
Definition at line 379 of file zcodec.cxx.
References BeginCompression(), Decompress(), EndCompression(), SvStream::GetError(), InitDecompress(), mbStatus, meState, SvStream::Seek(), STATE_INIT, SvStream::Tell(), and ZCODEC_DEFAULT_COMPRESSION.
void ZCodec::BeginCompression | ( | int | nCompressLevel = ZCODEC_DEFAULT_COMPRESSION , |
bool | gzLib = false |
||
) |
Definition at line 75 of file zcodec.cxx.
References mbFinish, mbGzLib, mbStatus, meState, mnCompressLevel, mnInToRead, mpInBuf, mpOStm, mpOutBuf, mpsC_Stream, and STATE_INIT.
Referenced by AttemptDecompression().
Definition at line 156 of file zcodec.cxx.
References ImplWriteBack(), InitCompress(), mbStatus, meState, mnInBufSize, mnUncompressedSize, mpInBuf, mpOStm, mpsC_Stream, SvStream::ReadBytes(), SvStream::Seek(), STATE_INIT, and SvStream::TellEnd().
tools::Long ZCodec::Decompress | ( | SvStream & | rIStm, |
SvStream & | rOStm | ||
) |
Definition at line 181 of file zcodec.cxx.
References err, ImplWriteBack(), InitDecompress(), mbStatus, meState, mnInBufSize, mnInToRead, mnOutBufSize, mpInBuf, mpOStm, mpOutBuf, mpsC_Stream, SvStream::ReadBytes(), and STATE_INIT.
Referenced by AttemptDecompression().
tools::Long ZCodec::EndCompression | ( | ) |
Definition at line 94 of file zcodec.cxx.
References GZ_DEFLATE, GZ_FS_UNKNOWN, GZ_MAGIC_BYTES_LE, GZ_ORIG_NAME, ImplWriteBack(), mbGzLib, mbStatus, meState, mnInBufCRC32, mnLastModifiedTime, mnUncompressedSize, mpInBuf, mpOStm, mpOutBuf, mpsC_Stream, msFilename, SvStream::Seek(), SvStream::SeekRel(), STATE_COMPRESS, STATE_INIT, STREAM_SEEK_TO_END, SvStream::WriteBytes(), SvStream::WriteUInt16(), SvStream::WriteUInt32(), and SvStream::WriteUInt8().
Referenced by AttemptDecompression().
|
private |
Definition at line 285 of file zcodec.cxx.
References mnOutBufSize, mpOStm, mpOutBuf, mpsC_Stream, and SvStream::WriteBytes().
Referenced by Compress(), Decompress(), EndCompression(), and Write().
|
private |
Definition at line 298 of file zcodec.cxx.
References mbGzLib, mbStatus, meState, mnCompressLevel, mnOutBufSize, mpOStm, mpOutBuf, mpsC_Stream, msFilename, SvStream::Seek(), STATE_COMPRESS, and STATE_INIT.
Referenced by Compress(), and Write().
|
private |
Definition at line 319 of file zcodec.cxx.
References SvStream::eof(), GZ_COMMENT, GZ_EXTRA_FIELD, GZ_HEAD_CRC, GZ_MAGIC_BYTES_LE, GZ_ORIG_NAME, GZ_RESERVED, mbGzLib, mbStatus, meState, mnInBufSize, mpInBuf, mpsC_Stream, n1, n2, SvStream::ReadUChar(), SvStream::ReadUInt16(), SvStream::Seek(), SvStream::SeekRel(), STATE_DECOMPRESS, and STATE_INIT.
Referenced by AttemptDecompression(), Decompress(), and Read().
|
static |
Checks whether a stream is Z compressed.
rIStm | the stream to check |
Definition at line 65 of file zcodec.cxx.
References GZ_MAGIC_BYTES_LE, SvStream::ReadUInt16(), SvStream::Seek(), and SvStream::Tell().
tools::Long ZCodec::Read | ( | SvStream & | rIStm, |
sal_uInt8 * | pData, | ||
sal_uInt32 | nSize | ||
) |
Definition at line 244 of file zcodec.cxx.
References err, InitDecompress(), mbFinish, mbStatus, meState, mnInBufSize, mnInToRead, mpInBuf, mpsC_Stream, pData, SvStream::ReadBytes(), and STATE_INIT.
void ZCodec::SetCompressionMetadata | ( | const OString & | sFilename, |
sal_uInt32 | nLastModifiedTime, | ||
sal_uInt32 | nInBufCRC32 | ||
) |
Set metadata for gzlib compression.
sFilename | the uncompressed file filename |
nLastModifiedTime | the files last modified time in unix format |
Definition at line 148 of file zcodec.cxx.
References mbGzLib, mnInBufCRC32, mnLastModifiedTime, and msFilename.
Definition at line 218 of file zcodec.cxx.
References ImplWriteBack(), InitCompress(), mbStatus, meState, mpOStm, mpsC_Stream, pData, and STATE_INIT.
|
private |
Definition at line 45 of file zcodec.hxx.
Referenced by BeginCompression(), and Read().
|
private |
Definition at line 58 of file zcodec.hxx.
Referenced by BeginCompression(), EndCompression(), InitCompress(), InitDecompress(), and SetCompressionMetadata().
|
private |
Definition at line 44 of file zcodec.hxx.
Referenced by AttemptDecompression(), BeginCompression(), Compress(), Decompress(), EndCompression(), InitCompress(), InitDecompress(), Read(), and Write().
|
private |
Definition at line 43 of file zcodec.hxx.
Referenced by AttemptDecompression(), BeginCompression(), Compress(), Decompress(), EndCompression(), InitCompress(), InitDecompress(), Read(), and Write().
|
private |
Definition at line 57 of file zcodec.hxx.
Referenced by BeginCompression(), and InitCompress().
|
private |
Definition at line 53 of file zcodec.hxx.
Referenced by EndCompression(), and SetCompressionMetadata().
|
private |
Definition at line 47 of file zcodec.hxx.
Referenced by Compress(), Decompress(), InitDecompress(), and Read().
|
private |
Definition at line 48 of file zcodec.hxx.
Referenced by BeginCompression(), Decompress(), and Read().
|
private |
Definition at line 54 of file zcodec.hxx.
Referenced by EndCompression(), and SetCompressionMetadata().
|
private |
Definition at line 51 of file zcodec.hxx.
Referenced by Decompress(), ImplWriteBack(), and InitCompress().
|
private |
Definition at line 52 of file zcodec.hxx.
Referenced by Compress(), and EndCompression().
|
private |
Definition at line 46 of file zcodec.hxx.
Referenced by BeginCompression(), Compress(), Decompress(), EndCompression(), InitDecompress(), and Read().
|
private |
Definition at line 49 of file zcodec.hxx.
Referenced by BeginCompression(), Compress(), Decompress(), EndCompression(), ImplWriteBack(), InitCompress(), and Write().
|
private |
Definition at line 50 of file zcodec.hxx.
Referenced by BeginCompression(), Decompress(), EndCompression(), ImplWriteBack(), and InitCompress().
|
private |
Definition at line 59 of file zcodec.hxx.
Referenced by BeginCompression(), Compress(), Decompress(), EndCompression(), ImplWriteBack(), InitCompress(), InitDecompress(), Read(), Write(), ZCodec(), and ~ZCodec().
|
private |
Definition at line 55 of file zcodec.hxx.
Referenced by EndCompression(), InitCompress(), and SetCompressionMetadata().