Class: Zip::ZipStreamableStream
- Defined in:
- lib/ruby_archive/handlers/rubyzip/zip/zip.rb
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, Zip::ZipEntry::VERSION_NEEDED_TO_EXTRACT
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
#<=>, #==, #calculate_local_header_size, #cdir_header_size, #comment_in, #directory?, #extract, #file?, #file_stat, #gather_fileinfo_from_srcpath, #get_extra_attributes_from_path, #get_raw_input_stream, #local_entry_offset, #name_encoding, #name_in, #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.
1625 1626 1627 1628 1629 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1625 def initialize(entry) super(entry) @tempFile = Tempfile.new(File.basename(name), File.dirname(zipfile)) @tempFile.binmode end |
Instance Method Details
#get_input_stream ⇒ Object
1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 |
# File 'lib/ruby_archive/handlers/rubyzip/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 |
#get_output_stream ⇒ Object
1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1631 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
1660 1661 1662 1663 |
# File 'lib/ruby_archive/handlers/rubyzip/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 |