Ghidra 11.3.2
Ghidra internal decompiler documentation.
Loading...
Searching...
No Matches
ghidra::Compress Class Reference

Wrapper for the deflate algorithm. More...

#include <compression.hh>

Public Member Functions

 Compress (int4 level)
 Initialize the deflate algorithm state.
 
 ~Compress (void)
 Free algorithm state resources.
 
void input (uint1 *buffer, int4 sz)
 Provide the next sequence of bytes to be compressed.
 
int4 deflate (uint1 *buffer, int4 sz, bool finish)
 Deflate as much as possible into given buffer.
 

Private Attributes

z_stream compStream
 The zlib deflate algorithm state.
 

Detailed Description

Wrapper for the deflate algorithm.

Initialize/free algorithm resources. Provide successive arrays of bytes to compress via the input() method. Compute successive arrays of compressed bytes via the deflate() method.

Constructor & Destructor Documentation

◆ Compress()

ghidra::Compress::Compress ( int4  level)

Initialize the deflate algorithm state.

The compression level ranges from 1-9 from faster/least compression to slower/most compression. Use a level of 0 for no compression and -1 for the default compression level.

Parameters
levelis the compression level

References compStream.

Member Function Documentation

◆ deflate()

int4 ghidra::Compress::deflate ( uint1 *  buffer,
int4  sz,
bool  finish 
)

Deflate as much as possible into given buffer.

Return the number of bytes of output space still available. Output may be limited by the amount of space in the output buffer or the amount of data available in the current input buffer.

Parameters
bufferis where compressed bytes are stored
szis the size, in bytes, of the buffer
finishis set to true if this is the final buffer to add to the stream
Returns
the number of output bytes still available

References compStream, and deflate().

Referenced by deflate(), and ghidra::CompressBuffer::flushInput().

◆ input()

void ghidra::Compress::input ( uint1 *  buffer,
int4  sz 
)
inline

Provide the next sequence of bytes to be compressed.

Parameters
bufferis a pointer to the bytes to compress
szis the number of bytes

References compStream.

Referenced by ghidra::CompressBuffer::flushInput().


The documentation for this class was generated from the following files: