Sha256: de08e668a439897b45a9e26553d518ccccf781f2e4ac94c52d0f04121cd4e035
Contents?: true
Size: 1.14 KB
Versions: 4
Compression:
Stored size: 1.14 KB
Contents
module Zip class StreamableStream < DelegateClass(Entry) #nodoc:all def initialize(entry) super(entry) @tempFile = Tempfile.new(::File.basename(name), ::File.dirname(zipfile)) @tempFile.binmode end def get_output_stream if block_given? begin yield(@tempFile) ensure @tempFile.close end else @tempFile end end 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 def write_to_zip_output_stream(aZipOutputStream) aZipOutputStream.put_next_entry(self) get_input_stream { |is| ::Zip::IOExtras.copy_stream(aZipOutputStream, is) } end end end # Copyright (C) 2002, 2003 Thomas Sondergaard # rubyzip is free software; you can redistribute it and/or # modify it under the terms of the ruby license.
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
rubyzip-1.1.0 | lib/zip/streamable_stream.rb |
rubyzip-1.0.0 | lib/zip/streamable_stream.rb |
rubyzip-1.0.0.beta1 | lib/zip/streamable_stream.rb |
superp-rubyzip-0.1.0 | lib/zip/streamable_stream.rb |