Class Zip::ZipStreamableStream
In: lib/zip/zip.rb
Parent: DelegateClass(ZipEntry)

Methods

Public Class methods

[Source]

# File lib/zip/zip.rb, line 1625
    def initialize(entry)
      super(entry)
      @tempFile = Tempfile.new(File.basename(name), File.dirname(zipfile))
      @tempFile.binmode
    end

Public Instance methods

[Source]

# File lib/zip/zip.rb, line 1643
    def get_input_stream
      if ! @tempFile.closed?
        raise StandardError, "cannot open entry for reading while its open for writing - #{name}"
      end
      @tempFile.open # reopens tempfile from top
      @tempFile.binmode
      if block_given?
        begin
          yield(@tempFile)
        ensure
          @tempFile.close
        end
      else
        @tempFile
      end
    end

[Source]

# File lib/zip/zip.rb, line 1631
    def get_output_stream
      if block_given?
        begin
          yield(@tempFile)
        ensure
          @tempFile.close
        end
      else
        @tempFile
      end
    end

[Source]

# File lib/zip/zip.rb, line 1660
    def write_to_zip_output_stream(aZipOutputStream)
      aZipOutputStream.put_next_entry(self)
      get_input_stream { |is| IOExtras.copy_stream(aZipOutputStream, is) } 
    end

[Validate]