BZ2::Writer (Class)

In: bz2.rb
Parent: Object

The class for compressing data

Methods

<<   close   close!   finish   flush   new   open   print   printf   putc   puts   to_io   write  

Public Class methods

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

Public Instance methods

Writes object. object will be converted to a string using to_s

Terminate the compression.

Terminate the compression and close the associated object

Flush the data and terminate the compression, the object can be re-used to store another compressed string

same than finish

Writes the given object(s)

Formats and writes the given object(s)

Writes the given character

Writes the given objects

return the associated object

Write the string str

[Validate]