class LZ4Reader

Declaration

class LZ4Reader : public ICompressedReader { /* full declaration omitted */ };

Description

ICompressedReader implementation that decompresses LZ4 (https://lz4.github.io/lz4/) data.

Declared at: mcap/include/mcap/reader.hpp:194

Inherits from: ICompressedReader

Method Overview

  • public LZ4Reader()
  • public LZ4Reader(const mcap::LZ4Reader &)
  • public LZ4Reader(mcap::LZ4Reader &&)
  • public mcap::Status decompressAll(const std::byte * data, uint64_t size, uint64_t uncompressedSize, mcap::ByteArray * output)
  • public uint64_t read(std::byte ** output, uint64_t offset, uint64_t size)
  • public void reset(const std::byte * data, uint64_t size, uint64_t uncompressedSize)
  • public uint64_t size() const
  • public mcap::Status status() const
  • public ~LZ4Reader()

Inherited from ICompressedReader:

Inherited from IReadable:

Methods

LZ4Reader()

Declared at: mcap/include/mcap/reader.hpp:213

LZ4Reader(const mcap::LZ4Reader&)

Declared at: mcap/include/mcap/reader.hpp:214

Parameters

const mcap::LZ4Reader&

LZ4Reader(mcap::LZ4Reader&&)

Declared at: mcap/include/mcap/reader.hpp:216

Parameters

mcap::LZ4Reader&&

mcap::Status decompressAll(
    const std::byte* data,
    uint64_t size,
    uint64_t uncompressedSize,
    mcap::ByteArray* output)

Description

Decompresses an entire LZ4-encoded chunk into `output`.

Declared at: mcap/include/mcap/reader.hpp:211

Parameters

const std::byte* data
The LZ4-compressed input chunk.
uint64_t size
The size of the LZ4-compressed input.
uint64_t uncompressedSize
The size of the data once uncompressed.
mcap::ByteArray* output
The output vector. This will be resized to `uncompressedSize` to fit the data, or 0 if the decompression encountered an error.

Returns

Status

uint64_t read(std::byte** output,
              uint64_t offset,
              uint64_t size)

Description

This method is called by MCAP reader classes when they need to read a portion of the file.

Declared at: mcap/include/mcap/reader.hpp:197

Parameters

std::byte** output
A pointer to a pointer to the buffer to write to. This method is expected to either maintain an internal buffer, read data into it, and update this pointer to point at the internal buffer, or update this pointer to point directly at the source data if possible. The pointer and data must remain valid and unmodified until the next call to read().
uint64_t offset
The offset in bytes from the beginning of the file to read.
uint64_t size
The number of bytes to read.

Returns

uint64_t Number of bytes actually read. This may be less than the requested size if the end of the file is reached. The output pointer must be readable from `output` to `output + size`. If the read fails, this method should return 0.

void reset(const std::byte* data,
           uint64_t size,
           uint64_t uncompressedSize)

Description

Reset the reader state, clearing any internal buffers and state, and initialize with new compressed data.

Declared at: mcap/include/mcap/reader.hpp:196

Parameters

const std::byte* data
Compressed data to read from.
uint64_t size
Size of the compressed data in bytes.
uint64_t uncompressedSize
Size of the data in bytes after decompression. A buffer of this size will be allocated for the uncompressed data.

uint64_t size() const

Description

Returns the size of the file in bytes.

Declared at: mcap/include/mcap/reader.hpp:198

Returns

uint64_t The total number of bytes in the MCAP file.

mcap::Status status() const

Description

Report the current status of decompression. A StatusCode other than `StatusCode::Success` after `reset()` is called indicates the decompression was not successful and the reader is in an invalid state.

Declared at: mcap/include/mcap/reader.hpp:199

~LZ4Reader()

Declared at: mcap/include/mcap/reader.hpp:218