In: |
bz2.rb
|
Parent: | Object |
The class for compressing data
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
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.
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 new for blocks and work