Object
Archive::Zip::Codec::Deflate is a handle for the deflate-inflate codec as defined in Zlib which provides convenient interfaces for writing and reading deflated streams.
A bit mask used to denote that Zlib's lowest/fastest compression level should be used.
The numeric identifier assigned to this compression codec by the ZIP specification.
A bit mask used to denote that Zlib's highest/slowest compression level should be used.
A bit mask used to denote that Zlib's default compression level should be used.
A bit mask used to denote that Zlib should not compress data at all.
This method signature is part of the interface contract expected by Archive::Zip::Entry for compression codec objects.
Creates a new instance of this class using bits 1 and 2 of general_purpose_flags to select a compression level to be used by compressor to set up a compression IO object. The constants NORMAL, MAXIMUM, FAST, and SUPER_FAST can be used for general_purpose_flags to manually set the compression level.
# File lib/archive/zip/codec/deflate.rb, line 189 def initialize(general_purpose_flags = NORMAL) @compression_level = general_purpose_flags & 0b110 @zlib_compression_level = case @compression_level when NORMAL Zlib::DEFAULT_COMPRESSION when MAXIMUM Zlib::BEST_COMPRESSION when FAST Zlib::BEST_SPEED when SUPER_FAST Zlib::NO_COMPRESSION else raise Error, 'Invalid compression level' end end
This method signature is part of the interface contract expected by Archive::Zip::Entry for compression codec objects.
Returns an integer used to flag that this compression codec is used for a particular ZIP archive entry.
# File lib/archive/zip/codec/deflate.rb, line 240 def compression_method ID end
This method signature is part of the interface contract expected by Archive::Zip::Entry for compression codec objects.
A convenience method for creating an Archive::Zip::Codec::Deflate::Compress object using that class' open method. The compression level for the open method is pulled from the value of the general_purpose_flags argument of new.
# File lib/archive/zip/codec/deflate.rb, line 212 def compressor(io, &b) Compress.open(io, @zlib_compression_level, &b) end
This method signature is part of the interface contract expected by Archive::Zip::Entry for compression codec objects.
A convenience method for creating an Archive::Zip::Codec::Deflate::Decompress object using that class' open method.
# File lib/archive/zip/codec/deflate.rb, line 222 def decompressor(io, &b) Decompress.open(io, &b) end
This method signature is part of the interface contract expected by Archive::Zip::Entry for compression codec objects.
Returns an integer representing the general purpose flags of a ZIP archive entry where bits 1 and 2 are set according to the compression level selected for this object. All other bits are zero'd out.
# File lib/archive/zip/codec/deflate.rb, line 250 def general_purpose_flags @compression_level end
This method signature is part of the interface contract expected by Archive::Zip::Entry for compression codec objects.
Returns an integer which indicates the version of the official ZIP specification which introduced support for this compression codec.
# File lib/archive/zip/codec/deflate.rb, line 231 def version_needed_to_extract 0x0014 end
Generated with the Darkfish Rdoc Generator 2.