Method: Zip::CentralDirectory#get_e_o_c_d
- Defined in:
- lib/zip/central_directory.rb
#get_e_o_c_d(io) ⇒ Object
:nodoc:
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/zip/central_directory.rb', line 89 def get_e_o_c_d(io) #:nodoc: begin io.seek(-MAX_END_OF_CENTRAL_DIRECTORY_STRUCTURE_SIZE, IO::SEEK_END) rescue Errno::EINVAL io.seek(0, IO::SEEK_SET) end buf = io.read sigIndex = buf.rindex([END_OF_CENTRAL_DIRECTORY_SIGNATURE].pack('V')) raise ZipError, "Zip end of central directory signature not found" unless sigIndex buf = buf.slice!((sigIndex + 4)..(buf.bytesize)) def buf.read(count) slice!(0, count) end buf end |