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(&a_proc)
click to toggle source
For iterating over the entries.
# File lib/zip/central_directory.rb, line 184 def each(&a_proc) @entry_set.each(&a_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 190 def size @entry_set.size end
start_buf(io)
click to toggle source
# File lib/zip/central_directory.rb, line 158 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 154 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