Class: IOStreams::Bzip2::Reader

Inherits:
Reader
  • Object
show all
Defined in:
lib/io_streams/bzip2/reader.rb

Instance Attribute Summary

Attributes inherited from Reader

#input_stream

Class Method Summary collapse

Methods inherited from Reader

file, #initialize, open

Constructor Details

This class inherits a constructor from IOStreams::Reader

Class Method Details

.stream(input_stream, **args) ⇒ Object

Read from a Bzip2 stream, decompressing the contents as it is read



5
6
7
8
9
10
11
12
13
14
# File 'lib/io_streams/bzip2/reader.rb', line 5

def self.stream(input_stream, **args)
  Utils.load_soft_dependency("bzip2-ffi", "Bzip2", "bzip2/ffi") unless defined?(::Bzip2::FFI)

  begin
    io = ::Bzip2::FFI::Reader.new(input_stream, args)
    yield io
  ensure
    io&.close
  end
end