MRPT  1.9.9
Functions
mrpt::io::zip Namespace Reference

Detailed Description

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

mrpt_io_grp

Functions

void compress (void *inData, size_t inDataSize, std::vector< unsigned char > &outData)
 Compress an array of bytes into another one. More...
 
void compress (const std::vector< unsigned char > &inData, std::vector< unsigned char > &outData)
 Compress an array of bytes into another one. More...
 
void compress (void *inData, size_t inDataSize, mrpt::io::CStream &out)
 Compress an array of bytes and write the result into a stream. More...
 
void compress (const std::vector< unsigned char > &inData, mrpt::io::CStream &out)
 Compress an array of bytes and write the result into a stream. More...
 
void decompress (void *inData, size_t inDataSize, std::vector< unsigned char > &outData, size_t outDataEstimatedSize)
 Decompress an array of bytes into another one. More...
 
void decompress (void *inData, size_t inDataSize, void *outData, size_t outDataBufferSize, size_t &outDataActualSize)
 Decompress an array of bytes into another one. More...
 
void decompress (mrpt::io::CStream &inStream, size_t inDataSize, void *outData, size_t outDataBufferSize, size_t &outDataActualSize)
 Decompress an array of bytes into another one. More...
 
bool decompress_gz_file (const std::string &file_path, std::vector< uint8_t > &buffer)
 Decompress a gzip file (xxxx.gz) into a memory buffer. More...
 
bool compress_gz_file (const std::string &file_path, const std::vector< uint8_t > &buffer, const int compress_level=9)
 Compress a memory buffer into a gzip file (xxxx.gz). More...
 
bool compress_gz_data_block (const std::vector< uint8_t > &in_data, std::vector< uint8_t > &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 decompress_gz_data_block (const std::vector< uint8_t > &in_gz_data, std::vector< uint8_t > &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::io::zip::compress ( void *  inData,
size_t  inDataSize,
std::vector< unsigned char > &  outData 
)

Compress an array of bytes into another one.

Definition at line 35 of file zip.cpp.

References ASSERT_, MRPT_END_WITH_CLEAN_UP, and MRPT_START.

Referenced by compress().

Here is the caller graph for this function:

◆ compress() [2/4]

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

Compress an array of bytes into another one.

Definition at line 58 of file zip.cpp.

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

Here is the call graph for this function:

◆ compress() [3/4]

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

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

Definition at line 81 of file zip.cpp.

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

Here is the call graph for this function:

◆ compress() [4/4]

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

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

Definition at line 108 of file zip.cpp.

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

Here is the call graph for this function:

◆ compress_gz_data_block()

bool mrpt::io::zip::compress_gz_data_block ( const std::vector< uint8_t > &  in_data,
std::vector< uint8_t > &  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 260 of file zip.cpp.

References mrpt::format(), mrpt::io::CFileInputStream::getTotalBytesCount(), mrpt::system::now(), mrpt::io::CFileInputStream::open(), mrpt::io::CFileInputStream::Read(), and THROW_EXCEPTION.

Referenced by TEST().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compress_gz_file()

bool mrpt::io::zip::compress_gz_file ( const std::string &  file_path,
const std::vector< uint8_t > &  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 234 of file zip.cpp.

References mrpt::io::CFileGZOutputStream::fileOpenCorrectly(), mrpt::io::CFileGZOutputStream::open(), and mrpt::io::CFileGZOutputStream::Write().

Here is the call graph for this function:

◆ decompress() [1/3]

void mrpt::io::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 enough

Definition at line 135 of file zip.cpp.

References ASSERT_, MRPT_END_WITH_CLEAN_UP, and MRPT_START.

◆ decompress() [2/3]

void mrpt::io::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 enough

Definition at line 159 of file zip.cpp.

References ASSERT_, MRPT_END_WITH_CLEAN_UP, and MRPT_START.

◆ decompress() [3/3]

void mrpt::io::zip::decompress ( mrpt::io::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 enough

Definition at line 182 of file zip.cpp.

References ASSERT_, MRPT_END_WITH_CLEAN_UP, MRPT_START, and mrpt::io::CStream::Read().

Here is the call graph for this function:

◆ decompress_gz_data_block()

bool mrpt::io::zip::decompress_gz_data_block ( const std::vector< uint8_t > &  in_gz_data,
std::vector< uint8_t > &  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 358 of file zip.cpp.

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

Referenced by TEST().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decompress_gz_file()

bool mrpt::io::zip::decompress_gz_file ( const std::string &  file_path,
std::vector< uint8_t > &  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 209 of file zip.cpp.

References mrpt::io::CFileGZInputStream::fileOpenCorrectly(), mrpt::io::CFileGZInputStream::getTotalBytesCount(), and mrpt::io::CFileGZInputStream::Read().

Referenced by decompress_gz_data_block().

Here is the call graph for this function:
Here is the caller graph for this function:



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020