Class JavaClass::Gems::ZipFile
In: lib/javaclass/gems/zip_file.rb
Parent: Object

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

Author:Peter Kofler

Methods

entries   new   read  

Public Class methods

[Source]

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

Public Instance methods

List the entries of this zip for the block given.

[Source]

# 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 the file from archive.

[Source]

# 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

[Validate]