Class: Bzip2::Reader
- Inherits:
-
Data
- Object
- Data
- Bzip2::Reader
- Includes:
- Enumerable
- Defined in:
- lib/bzip2/reader.rb,
ext/bzip2/bzip2.c
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')
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
- #close! ⇒ Object
- #closed? ⇒ Boolean (also: #closed)
- #each ⇒ Object (also: #each_line)
- #each_byte ⇒ Object
- #eof? ⇒ Boolean (also: #eof)
- #eoz? ⇒ Boolean (also: #eoz)
- #finish ⇒ Object
- #getc ⇒ Object
- #gets ⇒ Object
- #initialize ⇒ Object constructor
- #lineno ⇒ Object
- #lineno= ⇒ Object
- #read ⇒ Object
- #readchar ⇒ Object
- #readline ⇒ Object
- #readlines ⇒ Object
-
#to_io ⇒ File, String
Returns the io stream underlying this stream.
- #ungetc ⇒ Object
- #ungets ⇒ Object
- #unused ⇒ Object
- #unused= ⇒ Object
Constructor Details
#initialize ⇒ Object
Class Method Details
.allocate ⇒ Object
.foreach ⇒ Object
.open ⇒ Object
.readlines ⇒ Object
Instance Method Details
#close ⇒ Object
#close! ⇒ Object
#closed? ⇒ Boolean Also known as: closed
#each ⇒ Object Also known as: each_line
#each_byte ⇒ Object
#eof? ⇒ Boolean Also known as: eof
#eoz? ⇒ Boolean Also known as: eoz
#finish ⇒ Object
#getc ⇒ Object
#gets ⇒ Object
#lineno ⇒ Object
#lineno= ⇒ Object
#read ⇒ Object
#readchar ⇒ Object
#readline ⇒ Object
#readlines ⇒ Object
#to_io ⇒ File, String
Returns the io stream underlying this stream. If the strem was constructed with a file, that is returned. Otherwise, an empty string is returned.
76 77 78 79 80 81 |
# File 'ext/bzip2/bzip2.c', line 76
VALUE bz_to_io(VALUE obj) {
struct bz_file *bzf;
Get_BZ2(obj, bzf);
return bzf->io;
}
|