6#ifndef HUFFMANDECODER_HPP
7#define HUFFMANDECODER_HPP
32 unordered_map<uint32_t, uint8_t>
code;
60 vector<uint8_t>
decodeVec(
const vector<uint8_t> &buffer);
69 vector<uint8_t>
decodeFile(
const string &filenameIn,
const string &filenameOut);
76 vector<uint8_t>
decodeFile(
const string &filenameIn);
83 vector<uint8_t>
decodeVector(
const vector<uint8_t> &vector);
Handles reading a binary-encoded file, reconstructing the Huffman codes, and decoding the data.
Definition HuffmanDecoder.hpp:23
vector< uint8_t > decodeVector(const vector< uint8_t > &vector)
Decodes a Huffman-encoded byte vector in memory.
Definition HuffmanDecoder.cpp:144
vector< uint8_t > decodeVec(const vector< uint8_t > &buffer)
Decodes a buffer of raw Huffman-encoded bytes into original data.
Definition HuffmanDecoder.cpp:81
vector< uint8_t > decodeFile(const string &filenameIn, const string &filenameOut)
Decodes a file and writes the decoded output to another file.
Definition HuffmanDecoder.cpp:126
uint64_t current_position
Tracks the current byte position in the input file for reading code maps and data.
Definition HuffmanDecoder.hpp:37
uint8_t last_bit_to_read
Specifies how many bits in the last byte are valid and should be read.
Definition HuffmanDecoder.hpp:42
void readCodes()
Reads the Huffman header and code mappings from the encoded file.
Definition HuffmanDecoder.cpp:3
vector< uint8_t > readMessage()
Reads and decodes the Huffman-encoded message from the input file.
Definition HuffmanDecoder.cpp:66
ifstream inFile
Input file stream from which the encoded data is read.
Definition HuffmanDecoder.hpp:27
unordered_map< uint32_t, uint8_t > code
Maps Huffman codes (represented as integers) to original byte values.
Definition HuffmanDecoder.hpp:32