BZ2 (Module)

In: bz2.rb

bz2 is an extension to use libbzip2 from ruby

classes implemented

BZ2::Reader:the class for decompressing data
BZ2::Writer:the class for compressing data
BZ2::Error:exception raised by BZ2
BZ2::EOZError:"End of Zip" exception

Methods

bunzip2   bzip2   compress   uncompress  

Classes and Modules

Class BZ2::ConfigError
Class BZ2::EOZError
Class BZ2::Error
Class BZ2::Reader
Class BZ2::Writer

Public Class methods

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

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.

[Validate]