Class: Bzip2::Reader

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

Overview

Bzip2::Reader is meant to read streams of bz2 compressed bytes. It behaves like an IO object with many similar methods. It also includes the Enumerable module and each element is a ‘line’ in the stream.

It can both decompress files:

reader = Bzip2::Reader.open('file')
puts reader.read

reader = Bzip2::Reader.new File.open('file')
put reader.gets

And it may just decompress raw strings

reader = Bzip2::Reader.new compressed_string
reader = Bzip2::Reader.new Bzip2.compress('compress-me')