Class | Archive::Zip::Codec::Deflate::Compress |
In: |
lib/archive/zip/codec/deflate.rb
|
Parent: | Zlib::ZWriter |
Archive::Zip::Codec::Deflate::Compress extends Zlib::ZWriter in order to specify the standard Zlib options required by ZIP archives and to provide a close method which can optionally close the delegate IO-like object. In addition a convenience method is provided for generating DataDescriptor objects based on the data which is passed through this object.
Instances of this class should only be accessed via the Archive::Zip::Codec::Deflate#compressor method.
crc32 | -> | checksum |
crc32 | [R] |
The CRC32 checksum of the uncompressed data written using this object.
NOTE: Anything still in the internal write buffer has not been processed, so calling flush prior to examining this attribute may be necessary for an accurate computation. |
Creates a new instance of this class using io as a data sink. io must be writable and must provide a write method as IO does or errors will be raised when performing write operations. compression_level must be one of Zlib::DEFAULT_COMPRESSION, Zlib::BEST_COMPRESSION, Zlib::BEST_SPEED, or Zlib::NO_COMPRESSION and specifies the amount of compression to be applied to the data stream.
Closes this object so that further write operations will fail. If close_delegate is true, the delegate object used as a data sink will also be closed using its close method.
Returns an instance of Archive::Zip::DataDescriptor with information regarding the data which has passed through this object to the delegate object. The close or flush methods should be called before using this method in order to ensure that any possibly buffered data is flushed to the delegate object; otherwise, the contents of the data descriptor may be inaccurate.