Class: Zip::ZipStreamableStream
Overview
nodoc:all
Constant Summary
Constants inherited from ZipEntry
Zip::ZipEntry::CDIR_ENTRY_STATIC_HEADER_LENGTH, Zip::ZipEntry::CENTRAL_DIRECTORY_ENTRY_SIGNATURE, Zip::ZipEntry::DEFLATED, Zip::ZipEntry::FSTYPES, Zip::ZipEntry::FSTYPE_ACORN, Zip::ZipEntry::FSTYPE_AMIGA, Zip::ZipEntry::FSTYPE_ATARI, Zip::ZipEntry::FSTYPE_ATHEOS, Zip::ZipEntry::FSTYPE_BEOS, Zip::ZipEntry::FSTYPE_CPM, Zip::ZipEntry::FSTYPE_FAT, Zip::ZipEntry::FSTYPE_HPFS, Zip::ZipEntry::FSTYPE_MAC, Zip::ZipEntry::FSTYPE_MAC_OSX, Zip::ZipEntry::FSTYPE_MVS, Zip::ZipEntry::FSTYPE_NTFS, Zip::ZipEntry::FSTYPE_QDOS, Zip::ZipEntry::FSTYPE_TANDEM, Zip::ZipEntry::FSTYPE_THEOS, Zip::ZipEntry::FSTYPE_TOPS20, Zip::ZipEntry::FSTYPE_UNIX, Zip::ZipEntry::FSTYPE_VFAT, Zip::ZipEntry::FSTYPE_VMS, Zip::ZipEntry::FSTYPE_VM_CMS, Zip::ZipEntry::FSTYPE_Z_SYSTEM, Zip::ZipEntry::LOCAL_ENTRY_SIGNATURE, Zip::ZipEntry::LOCAL_ENTRY_STATIC_HEADER_LENGTH, Zip::ZipEntry::LOCAL_ENTRY_TRAILING_DESCRIPTOR_LENGTH, Zip::ZipEntry::STORED
Instance Attribute Summary
Attributes inherited from ZipEntry
#comment, #compressed_size, #compression_method, #crc, #externalFileAttributes, #extra, #filepath, #follow_symlinks, #fstype, #ftype, #gp_flags, #header_signature, #localHeaderOffset, #name, #restore_ownership, #restore_permissions, #restore_times, #size, #unix_gid, #unix_perms, #unix_uid, #zipfile
Instance Method Summary collapse
- #get_input_stream ⇒ Object
- #get_output_stream ⇒ Object
-
#initialize(entry) ⇒ ZipStreamableStream
constructor
A new instance of ZipStreamableStream.
- #write_to_zip_output_stream(aZipOutputStream) ⇒ Object
Methods inherited from ZipEntry
#<=>, #==, #cdir_header_size, #directory?, #extract, #file?, #file_stat, #gather_fileinfo_from_srcpath, #get_extra_attributes_from_path, #get_raw_input_stream, #local_entry_offset, #local_header_size, #name_is_directory?, #next_header_offset, #parent_as_string, read_c_dir_entry, #read_c_dir_entry, #read_local_entry, read_local_entry, #set_extra_attributes_on_path, #symlink?, #time, #time=, #to_s, #write_c_dir_entry, #write_local_entry
Constructor Details
#initialize(entry) ⇒ ZipStreamableStream
Returns a new instance of ZipStreamableStream.
1591 1592 1593 1594 1595 |
# File 'lib/zip/zip.rb', line 1591 def initialize(entry) super(entry) @tempFile = Tempfile.new(File.basename(name), File.dirname(zipfile)) @tempFile.binmode end |
Instance Method Details
#get_input_stream ⇒ Object
1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 |
# File 'lib/zip/zip.rb', line 1609 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 ⇒ Object
1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 |
# File 'lib/zip/zip.rb', line 1597 def get_output_stream if block_given? begin yield(@tempFile) ensure @tempFile.close end else @tempFile end end |
#write_to_zip_output_stream(aZipOutputStream) ⇒ Object
1626 1627 1628 1629 |
# File 'lib/zip/zip.rb', line 1626 def write_to_zip_output_stream(aZipOutputStream) aZipOutputStream.put_next_entry(self) get_input_stream { |is| IOExtras.copy_stream(aZipOutputStream, is) } end |