Class: RLZ4::Dictionary

Inherits:
Object
  • Object
show all
Defined in:
lib/rlz4.rb

Class Method Summary collapse

Class Method Details

.new(bytes) ⇒ Object

Public constructor. Derives the LZ4 frame ‘Dict_ID` from the dictionary bytes (sha256 truncated to the first 4 bytes, little-endian) and forwards to the Rust extension. The id is what gets written into every emitted frame’s FrameDescriptor and what ‘#decompress` asserts the incoming frame declares before decoding.



15
16
17
18
# File 'lib/rlz4.rb', line 15

def self.new(bytes)
  id = Digest::SHA256.digest(bytes).byteslice(0, 4).unpack1("V")
  _native_new(bytes, id)
end