Class: Omnizip::Algorithms::Deflate::Decoder
- Inherits:
-
Object
- Object
- Omnizip::Algorithms::Deflate::Decoder
- Includes:
- Constants
- Defined in:
- lib/omnizip/algorithms/deflate/decoder.rb
Overview
Deflate decoder using Zlib
This class wraps Ruby's Zlib::Inflate to provide Deflate decompression following the established Omnizip architecture.
Constant Summary
Constants included from Constants
Constants::BEST_COMPRESSION, Constants::BEST_SPEED, Constants::BUFFER_SIZE, Constants::DEFAULT_COMPRESSION, Constants::DEFAULT_STRATEGY, Constants::FILTERED, Constants::FIXED, Constants::HUFFMAN_ONLY, Constants::NO_COMPRESSION, Constants::RLE
Instance Attribute Summary collapse
-
#input_stream ⇒ Object
readonly
Returns the value of attribute input_stream.
Instance Method Summary collapse
-
#decode_stream ⇒ String
Decode compressed data stream.
-
#initialize(input_stream) ⇒ Decoder
constructor
Initialize decoder.
Constructor Details
#initialize(input_stream) ⇒ Decoder
Initialize decoder
20 21 22 |
# File 'lib/omnizip/algorithms/deflate/decoder.rb', line 20 def initialize(input_stream) @input_stream = input_stream end |
Instance Attribute Details
#input_stream ⇒ Object (readonly)
Returns the value of attribute input_stream.
15 16 17 |
# File 'lib/omnizip/algorithms/deflate/decoder.rb', line 15 def input_stream @input_stream end |
Instance Method Details
#decode_stream ⇒ String
Decode compressed data stream
27 28 29 30 31 32 33 |
# File 'lib/omnizip/algorithms/deflate/decoder.rb', line 27 def decode_stream compressed = @input_stream.read inflater = Zlib::Inflate.new decompressed = inflater.inflate(compressed) inflater.close decompressed end |