class JavaClass::Gems::ZipFile

Abstraction of a Zip archive. Wraps around Zip::ZipFile of rubyzip

Author

Peter Kofler

Public Class Methods

new(file) click to toggle source
# File lib/javaclass/gems/zip_file.rb, line 121
def initialize(file)
  @archive = file
end

Public Instance Methods

entries(&block) click to toggle source

List the entries of this zip for the block given.

# File lib/javaclass/gems/zip_file.rb, line 135
def entries(&block)
  FILESYSTEM.foreach(@archive) do |entry|
    block.call(ZipEntry.new(entry))
  end
end
read(file) click to toggle source

Read the file from archive.

# File lib/javaclass/gems/zip_file.rb, line 126
def read(file)
  begin
    FILESYSTEM.open(@archive) { |zipfile| zipfile.file.read(file) }
  rescue
    nil
  end
end