Class: Cabriolet::Decompressors::Base
- Inherits:
-
Object
- Object
- Cabriolet::Decompressors::Base
- Defined in:
- lib/cabriolet/decompressors/base.rb
Overview
Base class for all decompression algorithms
Instance Attribute Summary collapse
-
#buffer_size ⇒ Object
readonly
Returns the value of attribute buffer_size.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#io_system ⇒ Object
readonly
Returns the value of attribute io_system.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#decompress(bytes) ⇒ Integer
Decompress the specified number of bytes.
-
#free ⇒ void
Free any resources used by the decompressor.
-
#initialize(io_system, input, output, buffer_size) ⇒ Base
constructor
Initialize a new decompressor.
Constructor Details
#initialize(io_system, input, output, buffer_size) ⇒ Base
Initialize a new decompressor
15 16 17 18 19 20 |
# File 'lib/cabriolet/decompressors/base.rb', line 15 def initialize(io_system, input, output, buffer_size) @io_system = io_system @input = input @output = output @buffer_size = buffer_size end |
Instance Attribute Details
#buffer_size ⇒ Object (readonly)
Returns the value of attribute buffer_size.
7 8 9 |
# File 'lib/cabriolet/decompressors/base.rb', line 7 def buffer_size @buffer_size end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
7 8 9 |
# File 'lib/cabriolet/decompressors/base.rb', line 7 def input @input end |
#io_system ⇒ Object (readonly)
Returns the value of attribute io_system.
7 8 9 |
# File 'lib/cabriolet/decompressors/base.rb', line 7 def io_system @io_system end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
7 8 9 |
# File 'lib/cabriolet/decompressors/base.rb', line 7 def output @output end |
Instance Method Details
#decompress(bytes) ⇒ Integer
Decompress the specified number of bytes
27 28 29 |
# File 'lib/cabriolet/decompressors/base.rb', line 27 def decompress(bytes) raise NotImplementedError, "#{self.class} must implement #decompress" end |
#free ⇒ void
This method returns an undefined value.
Free any resources used by the decompressor
34 35 36 |
# File 'lib/cabriolet/decompressors/base.rb', line 34 def free # Override in subclasses if cleanup needed end |