bz2 is an extension to use libbzip2 from ruby
bzip2(str, blocks = 9, work = 0)
compress(str, blocks = 9, work = 0)
Compress the String str
blocks specifies the block size to be used for compression. It should be a value between 1 and 9 inclusive, and the actual block size used is 100000 x this value
work controls how the compression phase behaves when presented with worst case, highly repetitive, input data.
You should set this parameter carefully; too low, and many inputs will be handled by the fallback algorithm and so compress rather slowly, too high, and your average-to-worst case compression times can become very large.
Allowable values range from 0 to 250 inclusive. 0 is a special case, equivalent to using the default value of 30.
The default value of 30 gives reasonable behaviour over a wide range of circumstances.
bunzip2(str, small = Qfalse)
uncompress(str, small = Qfalse)
Uncompress the String str
If small is true, the library will use an alternative decompression algorithm which uses less memory but at the cost of decompressing more slowly
allocate
new(object = nil, mode = "w", blocks = 9, work = 0)
Create a new BZ2::Writer associated with object.
object must respond to write, or must be nil in this case the compressed string is returned when flush is called
See initialize for blocks and work
open(filename, mode = "w", blocks = 9, work = 0) {|bz2| ... }
Call Kernel#open(filename), associate it a new BZ2::Writer and call the associated block if given.
The bz2 object is closed at the end of the block
See initialize for blocks and work
close
close!
finish
flush
initialize(object = nil, blocks = 9, work = 0)
If object is nil then the compression will be made in a String which is returned when close or flush is called
Otherwise object must respond to write(str)
blocks specifies the block size to be used for compression. It should be a value between 1 and 9 inclusive, and the actual block size used is 100000 x this value
work controls how the compression phase behaves when presented with worst case, highly repetitive, input data.
You should set this parameter carefully; too low, and many inputs will be handled by the fallback algorithm and so compress rather slowly, too high, and your average-to-worst case compression times can become very large.
Allowable values range from 0 to 250 inclusive. 0 is a special case, equivalent to using the default value of 30.
The default value of 30 gives reasonable behaviour over a wide range of circumstances.
<<(object)
print(object = $_, ...)
printf(format, object = $_, ...)
putc(char)
puts(object, ...)
to_io
write(str)
Included modules : Enumerable
allocate
foreach(filename, separator = $/) {|line| ... }
new(object, small = false)
Associate a new bz2 reader with object. object must respond to read
See initialize for small
open(filename, small = false) {|bz2| ... }
Call Kernel#open(filename), and associate it a new BZ2::Reader. The bz2 object is passed as an argument to the block.
The object is closed at the end of the block
See initialize for small
readlines(filename, separator = $/)
initialize(object, small = false)
object must be a String which contains compressed data, or an object which respond to read(size)
If small is true, the library will use an alternative decompression algorithm which uses less memory but at the cost of decompressing more slowly
close
close!
closed?
each(separator = $/) {|line| ... }
each_line(separator = $/) {|line| ... }
eof
eoz
finish
getc
gets(separator = $/)
lineno
lineno=(num)
read(number)
readline(separator = $/)
readlines(separator = $/)
to_io
ungetc(char)
ungets(str)
unused
unused=(str)
Indicates that the library has been improperly compiled on your platform
Exception raised by BZ2
"End of Zip" exception : compressed file finishes before the logical end of stream is detected