class Zip::CentralDirectory

Constants

END_OF_CDS
MAX_END_OF_CDS_SIZE
STATIC_EOCD_SIZE
ZIP64_END_OF_CDS
ZIP64_EOCD_LOCATOR

Attributes

comment[R]

Public Instance Methods

each(&proc) click to toggle source

For iterating over the entries.

# File lib/zip/central_directory.rb, line 181
def each(&proc)
  @entry_set.each(&proc)
end
entries() click to toggle source

Returns an Enumerable containing the entries.

# File lib/zip/central_directory.rb, line 14
def entries
  @entry_set.entries
end
size() click to toggle source

Returns the number of entries in the central directory (and consequently in the zip archive).

# File lib/zip/central_directory.rb, line 187
def size
  @entry_set.size
end
start_buf(io) click to toggle source
# File lib/zip/central_directory.rb, line 157
def start_buf(io)
  begin
    io.seek(-MAX_END_OF_CDS_SIZE, IO::SEEK_END)
  rescue Errno::EINVAL
    io.seek(0, IO::SEEK_SET)
  end
  io.read
end
zip64_file?(buf) click to toggle source
# File lib/zip/central_directory.rb, line 153
def zip64_file?(buf)
  buf.rindex([ZIP64_END_OF_CDS].pack('V')) && buf.rindex([ZIP64_EOCD_LOCATOR].pack('V'))
end

Private Instance Methods

write_64_eocd_locator(io, zip64_eocd_offset) click to toggle source
# File lib/zip/central_directory.rb, line 75
def write_64_eocd_locator(io, zip64_eocd_offset)
  tmp = [
    ZIP64_EOCD_LOCATOR,
    0, # number of disk containing the start of zip64 eocd record
    zip64_eocd_offset, # offset of the start of zip64 eocd record in its disk
    1 # total number of disks
  ]
  io << tmp.pack('VVQ<V')
end