Parent

Zip::StreamableStream

Public Class Methods

new(entry) click to toggle source
# File lib/zip/streamable_stream.rb, line 3
def initialize(entry)
  super(entry)
  dirname = if zipfile.is_a?(::String)
              ::File.dirname(zipfile)
            else
              '.'
            end
  @temp_file = Tempfile.new(::File.basename(name), dirname)
  @temp_file.binmode
end

Public Instance Methods

clean_up() click to toggle source
# File lib/zip/streamable_stream.rb, line 48
def clean_up
  @temp_file.unlink
end
get_input_stream() click to toggle source
# File lib/zip/streamable_stream.rb, line 26
def get_input_stream
  if !@temp_file.closed?
    raise StandardError, "cannot open entry for reading while its open for writing - #{name}"
  end
  @temp_file.open # reopens tempfile from top
  @temp_file.binmode
  if block_given?
    begin
      yield(@temp_file)
    ensure
      @temp_file.close
    end
  else
    @temp_file
  end
end
get_output_stream() click to toggle source
# File lib/zip/streamable_stream.rb, line 14
def get_output_stream
  if block_given?
    begin
      yield(@temp_file)
    ensure
      @temp_file.close
    end
  else
    @temp_file
  end
end
write_to_zip_output_stream(aZipOutputStream) click to toggle source
# File lib/zip/streamable_stream.rb, line 43
def write_to_zip_output_stream(aZipOutputStream)
  aZipOutputStream.put_next_entry(self)
  get_input_stream { |is| ::Zip::IOExtras.copy_stream(aZipOutputStream, is) }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.