Class: Omnizip::Implementations::Base::LZMAEncoderBase Abstract
- Inherits:
-
Object
- Object
- Omnizip::Implementations::Base::LZMAEncoderBase
- Defined in:
- lib/omnizip/implementations/base/lzma_encoder_base.rb
Overview
Subclasses must implement #encode_stream
Abstract base class for LZMA encoders.
This class defines the common interface and shared functionality for all LZMA encoder implementations (XZ Utils, 7-Zip SDK, etc.).
Subclasses must implement the #encode_stream method.
Instance Attribute Summary collapse
-
#dict_size ⇒ Object
readonly
Returns the value of attribute dict_size.
-
#lc ⇒ Object
readonly
Returns the value of attribute lc.
-
#lp ⇒ Object
readonly
Returns the value of attribute lp.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#pb ⇒ Object
readonly
Returns the value of attribute pb.
Instance Method Summary collapse
-
#encode_stream(data) ⇒ void
Encode a stream of data.
-
#implementation_name ⇒ Symbol
Get the implementation identifier.
-
#initialize(output, options = {}) ⇒ LZMAEncoderBase
constructor
Initialize the LZMA encoder.
Constructor Details
#initialize(output, options = {}) ⇒ LZMAEncoderBase
Initialize the LZMA encoder.
46 47 48 49 50 51 52 53 54 |
# File 'lib/omnizip/implementations/base/lzma_encoder_base.rb', line 46 def initialize(output, = {}) @output = output @lc = .fetch(:lc, 3) @lp = .fetch(:lp, 0) @pb = .fetch(:pb, 2) @dict_size = .fetch(:dict_size, 1 << 16) # 64KB default validate_parameters! end |
Instance Attribute Details
#dict_size ⇒ Object (readonly)
Returns the value of attribute dict_size.
35 36 37 |
# File 'lib/omnizip/implementations/base/lzma_encoder_base.rb', line 35 def dict_size @dict_size end |
#lc ⇒ Object (readonly)
Returns the value of attribute lc.
35 36 37 |
# File 'lib/omnizip/implementations/base/lzma_encoder_base.rb', line 35 def lc @lc end |
#lp ⇒ Object (readonly)
Returns the value of attribute lp.
35 36 37 |
# File 'lib/omnizip/implementations/base/lzma_encoder_base.rb', line 35 def lp @lp end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
35 36 37 |
# File 'lib/omnizip/implementations/base/lzma_encoder_base.rb', line 35 def output @output end |
#pb ⇒ Object (readonly)
Returns the value of attribute pb.
35 36 37 |
# File 'lib/omnizip/implementations/base/lzma_encoder_base.rb', line 35 def pb @pb end |
Instance Method Details
#encode_stream(data) ⇒ void
This method returns an undefined value.
Encode a stream of data.
Subclasses must implement this method to provide the specific encoding logic for their implementation (XZ Utils, 7-Zip, etc.).
64 65 66 67 |
# File 'lib/omnizip/implementations/base/lzma_encoder_base.rb', line 64 def encode_stream(data) raise NotImplementedError, "#{self.class} must implement #encode_stream" end |
#implementation_name ⇒ Symbol
Get the implementation identifier.
Subclasses must implement this to return a symbol identifying their implementation (e.g., :xz_utils, :seven_zip).
76 77 78 79 |
# File 'lib/omnizip/implementations/base/lzma_encoder_base.rb', line 76 def implementation_name raise NotImplementedError, "#{self.class} must implement #implementation_name" end |