Class: LZ4::Raw

Inherits:
Object
  • Object
show all
Defined in:
lib/lz4-ruby.rb

Overview

Handles LZ4 native data stream (without any additional headers).

Class Method Summary collapse

Class Method Details

.compress(source, options = {}) ⇒ String, Fixnum

Compresses ‘source` string.

Parameters:

  • source (String)

    string to be compressed

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :input_size (Fixnum)

    byte size of source to compress (must be less than or equal to ‘source.bytesize`)

  • :dest (String)

    output buffer which will receive compressed string

  • :max_output_size (Fixnum)

    acceptable maximum output size

Returns:

  • (String, Fixnum)

    compressed string and its length.



96
97
98
# File 'lib/lz4-ruby.rb', line 96

def self.compress(source, options = {})
  return _compress(source, false, options)
end

.compressHC(source, options = {}) ⇒ String, Fixnum

Compresses ‘source` string using High Compress Mode.

Parameters:

  • source (String)

    string to be compressed

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :input_size (Fixnum)

    byte size of source to compress (must be less than or equal to ‘source.bytesize`)

  • :dest (String)

    output buffer which will receive compressed string

  • :max_output_size (Fixnum)

    acceptable maximum output size

Returns:

  • (String, Fixnum)

    compressed string and its length.



108
109
110
# File 'lib/lz4-ruby.rb', line 108

def self.compressHC(source, options = {})
  return _compress(source, true, options)
end