Class: Zip::ZipStreamableStream

### Home Classes Methods

### In Files

- lib/zip/zip_streamable_stream.rb

### Parent

DelegateClass(ZipEntry)

### Methods

- ::new
- #get_input_stream
- #get_output_stream
- #write_to_zip_output_stream

### Class/Module Index

Quicksearch

- Zip
- Zip::ZipCentralDirectory
- Zip::ZipCompressionMethodError
- Zip::ZipDestinationFileExistsError
- Zip::ZipEntry
- Zip::ZipEntryExistsError
- Zip::ZipEntryNameError
- Zip::ZipError
- Zip::ZipExtraField
- Zip::ZipExtraField::Generic
- Zip::ZipExtraField::IUnix
- Zip::ZipExtraField::UniversalTime
- Zip::ZipFile
- Zip::ZipFileSystem
- Zip::ZipFileSystem::ZipFsDir
- Zip::ZipFileSystem::ZipFsFile
- Zip::ZipFileSystem::ZipFsFile::ZipFsStat
- Zip::ZipInputStream
- Zip::ZipInternalError
- Zip::ZipOutputStream
- Zip::ZipStreamableDirectory
- Zip::ZipStreamableStream
- IOExtras
- IOExtras::AbstractInputStream
- IOExtras::AbstractOutputStream
- IOExtras::FakeIO
- BugFix
- Object

No matching classes.

# Zip::ZipStreamableStream

### Public Class Methods

new(entry) click to toggle source

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

### Public Instance Methods

get_input_stream() click to toggle source

    # File lib/zip/zip_streamable_stream.rb, line 21
    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

get_output_stream() click to toggle source

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

write_to_zip_output_stream(aZipOutputStream) click to toggle source

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.