Main MRPT website > C++ reference for MRPT 1.5.9
Functions
mrpt::compress::zip Namespace Reference

Detailed Description

Compression using the "zip" algorithm and from/to gzip (gz) files.

Functions

void BASE_IMPEXP compress (void *inData, size_t inDataSize, std::vector< unsigned char > &outData)
 Compress an array of bytes into another one. More...
 
void BASE_IMPEXP compress (const std::vector< unsigned char > &inData, std::vector< unsigned char > &outData)
 Compress an array of bytes into another one. More...
 
void BASE_IMPEXP compress (void *inData, size_t inDataSize, mrpt::utils::CStream &out)
 Compress an array of bytes and write the result into a stream. More...
 
void BASE_IMPEXP compress (const std::vector< unsigned char > &inData, mrpt::utils::CStream &out)
 Compress an array of bytes and write the result into a stream. More...
 
void BASE_IMPEXP decompress (void *inData, size_t inDataSize, std::vector< unsigned char > &outData, size_t outDataEstimatedSize)
 Decompress an array of bytes into another one. More...
 
void BASE_IMPEXP decompress (void *inData, size_t inDataSize, void *outData, size_t outDataBufferSize, size_t &outDataActualSize)
 Decompress an array of bytes into another one. More...
 
void BASE_IMPEXP decompress (mrpt::utils::CStream &inStream, size_t inDataSize, void *outData, size_t outDataBufferSize, size_t &outDataActualSize)
 Decompress an array of bytes into another one. More...
 
bool BASE_IMPEXP decompress_gz_file (const std::string &file_path, vector_byte &buffer)
 Decompress a gzip file (xxxx.gz) into a memory buffer. More...
 
bool BASE_IMPEXP compress_gz_file (const std::string &file_path, const vector_byte &buffer, const int compress_level=9)
 Compress a memory buffer into a gzip file (xxxx.gz). More...
 
bool BASE_IMPEXP compress_gz_data_block (const vector_byte &in_data, vector_byte &out_gz_data, const int compress_level=9)
 Compress a memory buffer in gz-file format and return it as a block a memory. More...
 
bool BASE_IMPEXP decompress_gz_data_block (const vector_byte &in_gz_data, vector_byte &out_data)
 Decompress an array of bytes storing a gz-compressed stream of data into a memory buffer. More...
 

Function Documentation

◆ compress() [1/4]

void mrpt::compress::zip::compress ( void inData,
size_t  inDataSize,
std::vector< unsigned char > &  outData 
)

Compress an array of bytes into another one.

Definition at line 36 of file zip.cpp.

References ASSERT_, MRPT_END_WITH_CLEAN_UP, MRPT_START, and Z_OK.

Referenced by compress(), and mrpt::utils::CImage::writeToStream().

◆ compress() [2/4]

void mrpt::compress::zip::compress ( const std::vector< unsigned char > &  inData,
std::vector< unsigned char > &  outData 
)

Compress an array of bytes into another one.

Definition at line 66 of file zip.cpp.

References ASSERT_, compress(), MRPT_END_WITH_CLEAN_UP, MRPT_START, and Z_OK.

◆ compress() [3/4]

void mrpt::compress::zip::compress ( void inData,
size_t  inDataSize,
mrpt::utils::CStream out 
)

Compress an array of bytes and write the result into a stream.

Definition at line 95 of file zip.cpp.

References ASSERT_, compress(), MRPT_END_WITH_CLEAN_UP, MRPT_START, mrpt::utils::CStream::WriteBuffer(), and Z_OK.

◆ compress() [4/4]

void mrpt::compress::zip::compress ( const std::vector< unsigned char > &  inData,
mrpt::utils::CStream out 
)

Compress an array of bytes and write the result into a stream.

Definition at line 131 of file zip.cpp.

References ASSERT_, compress(), MRPT_END_WITH_CLEAN_UP, MRPT_START, mrpt::utils::CStream::WriteBuffer(), and Z_OK.

◆ compress_gz_data_block()

bool mrpt::compress::zip::compress_gz_data_block ( const vector_byte in_data,
vector_byte out_gz_data,
const int  compress_level = 9 
)

Compress a memory buffer in gz-file format and return it as a block a memory.

compress_level: 0=no compression, 1=best speed, 9=maximum

Returns
true on success, false on error.
Note
If in_data is empty, an empty buffer is returned in out_gz_data and no error is reported.
See also
compress_gz_file, de

Definition at line 325 of file zip.cpp.

References mrpt::format(), mrpt::utils::CFileInputStream::getTotalBytesCount(), mrpt::system::now(), mrpt::utils::CFileInputStream::open(), mrpt::utils::CStream::ReadBuffer(), and THROW_EXCEPTION.

Referenced by TEST().

◆ compress_gz_file()

bool mrpt::compress::zip::compress_gz_file ( const std::string file_path,
const vector_byte buffer,
const int  compress_level = 9 
)

Compress a memory buffer into a gzip file (xxxx.gz).

compress_level: 0=no compression, 1=best speed, 9=maximum

Returns
true on success, false on error.
See also
decompress_gz_file, compress_gz_data_block

Definition at line 291 of file zip.cpp.

References CFileGZOutputStream, and THROW_EXCEPTION.

◆ decompress() [1/3]

void mrpt::compress::zip::decompress ( void inData,
size_t  inDataSize,
std::vector< unsigned char > &  outData,
size_t  outDataEstimatedSize 
)

Decompress an array of bytes into another one.

Exceptions
std::exceptionIf the apriori estimated decompressed size is not enought

Definition at line 165 of file zip.cpp.

References ASSERT_, MRPT_END_WITH_CLEAN_UP, MRPT_START, and Z_OK.

Referenced by mrpt::utils::CImage::readFromStream().

◆ decompress() [2/3]

void mrpt::compress::zip::decompress ( void inData,
size_t  inDataSize,
void outData,
size_t  outDataBufferSize,
size_t &  outDataActualSize 
)

Decompress an array of bytes into another one.

Exceptions
std::exceptionIf the apriori estimated decompressed size is not enought

Definition at line 196 of file zip.cpp.

References ASSERT_, MRPT_END_WITH_CLEAN_UP, MRPT_START, and Z_OK.

◆ decompress() [3/3]

void mrpt::compress::zip::decompress ( mrpt::utils::CStream inStream,
size_t  inDataSize,
void outData,
size_t  outDataBufferSize,
size_t &  outDataActualSize 
)

Decompress an array of bytes into another one.

Exceptions
std::exceptionIf the apriori estimated decompressed size is not enought

Definition at line 227 of file zip.cpp.

References ASSERT_, MRPT_END_WITH_CLEAN_UP, MRPT_START, mrpt::utils::CStream::ReadBuffer(), and Z_OK.

◆ decompress_gz_data_block()

bool mrpt::compress::zip::decompress_gz_data_block ( const vector_byte in_gz_data,
vector_byte out_data 
)

Decompress an array of bytes storing a gz-compressed stream of data into a memory buffer.

If the input data is not recognized as a .gz file, the output data will be an exact copy of the input.

Returns
true on success, false on error.
See also
decompress_gz_file, compress_gz_data_block

Definition at line 435 of file zip.cpp.

References decompress_gz_file(), mrpt::system::getTempFileName(), and mrpt::system::vectorToBinaryFile().

Referenced by TEST().

◆ decompress_gz_file()

bool mrpt::compress::zip::decompress_gz_file ( const std::string file_path,
vector_byte buffer 
)

Decompress a gzip file (xxxx.gz) into a memory buffer.

If the file is not a .gz file, it just read the whole file unmodified.

Returns
true on success, false on error.
See also
compress_gz_file, decompress_gz_data_block

Definition at line 263 of file zip.cpp.

References mrpt::utils::CFileGZInputStream::fileOpenCorrectly(), mrpt::utils::CFileGZInputStream::getTotalBytesCount(), and mrpt::utils::CStream::ReadBuffer().

Referenced by decompress_gz_data_block(), and mrpt::opengl::C3DSScene::loadFrom3DSFile().




Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020