Class: Omnizip::Algorithms::BZip2::Decoder
- Inherits:
-
Object
- Object
- Omnizip::Algorithms::BZip2::Decoder
- Defined in:
- lib/omnizip/algorithms/bzip2/decoder.rb
Overview
BZip2 Decoder
Reverses the full BZip2 compression pipeline:
- Read block headers
- Decode Huffman coding
- Reverse Run-Length Encoding (RLE)
- Reverse Move-to-Front Transform (MTF)
- Reverse Burrows-Wheeler Transform (BWT)
- Verify CRC32 checksum
Processes each block independently and concatenates results.
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Instance Method Summary collapse
-
#decode_stream ⇒ String
Decode stream using BZip2 algorithm.
-
#initialize(input, _options = {}) ⇒ Decoder
constructor
Initialize decoder.
Constructor Details
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
38 39 40 |
# File 'lib/omnizip/algorithms/bzip2/decoder.rb', line 38 def input @input end |
Instance Method Details
#decode_stream ⇒ String
Decode stream using BZip2 algorithm
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/omnizip/algorithms/bzip2/decoder.rb', line 55 def decode_stream result = [] # Read and decode all blocks loop do block_data = decode_block break unless block_data result << block_data end result.join.b end |