Class: Archive::Zip::Codec::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/archive/zip/codec/store.rb,
lib/archive/zip/codec/store/reader.rb,
lib/archive/zip/codec/store/writer.rb

Overview

Archive::Zip::Codec::Store is a handle for the store-unstore (no compression) codec.

Defined Under Namespace

Classes: Reader, Writer

Constant Summary collapse

ID =

The numeric identifier assigned to this compresion codec by the ZIP specification.

0

Instance Method Summary collapse

Constructor Details

#initialize(general_purpose_flags = 0) ⇒ Store

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. general_purpose_flags is not used.



22
23
# File 'lib/archive/zip/codec/store.rb', line 22

def initialize(general_purpose_flags = 0)
end

Instance Method Details

#compression_methodObject

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.



58
59
60
# File 'lib/archive/zip/codec/store.rb', line 58

def compression_method
  ID
end

#compressor(io, &b) ⇒ Object

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::Store::Writer object using that class’ open method.



30
31
32
# File 'lib/archive/zip/codec/store.rb', line 30

def compressor(io, &b)
  Writer.open(io, &b)
end

#decompressor(io, &b) ⇒ Object

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::Store::Reader object using that class’ open method.



40
41
42
# File 'lib/archive/zip/codec/store.rb', line 40

def decompressor(io, &b)
  Reader.open(io, &b)
end

#general_purpose_flagsObject

This method signature is part of the interface contract expected by Archive::Zip::Entry for compression codec objects.

Returns 0 since this compression codec does not make use of general purpose flags of ZIP archive entries.



67
68
69
# File 'lib/archive/zip/codec/store.rb', line 67

def general_purpose_flags
  0
end

#version_needed_to_extractObject

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.



49
50
51
# File 'lib/archive/zip/codec/store.rb', line 49

def version_needed_to_extract
  0x000a
end