Class: Zip::ZipStreamableFile
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::LOCAL_ENTRY_SIGNATURE, Zip::ZipEntry::LOCAL_ENTRY_STATIC_HEADER_LENGTH, Zip::ZipEntry::STORED
Instance Attribute Summary
Attributes inherited from ZipEntry
#comment, #compressed_size, #compression_method, #crc, #externalFileAttributes, #extra, #fstype, #localHeaderOffset, #name, #size, #zipfile
Instance Method Summary collapse
- #==(other) ⇒ Object
- #get_input_stream(&aProc) ⇒ Object
-
#initialize(entry, filepath) ⇒ ZipStreamableFile
constructor
A new instance of ZipStreamableFile.
- #write_to_zip_output_stream(aZipOutputStream) ⇒ Object
Methods inherited from ZipEntry
#<=>, #cdir_header_size, #directory?, #file?, #get_raw_input_stream, #local_entry_offset, #local_header_size, #next_header_offset, #parent_as_string, #read_c_dir_entry, read_c_dir_entry, #read_local_entry, read_local_entry, #time, #time=, #to_s, #write_c_dir_entry, #write_local_entry
Constructor Details
#initialize(entry, filepath) ⇒ ZipStreamableFile
Returns a new instance of ZipStreamableFile.
1084 1085 1086 1087 1088 |
# File 'lib/zip/zip.rb', line 1084 def initialize(entry, filepath) super(entry) @delegate = entry @filepath = filepath end |
Instance Method Details
#==(other) ⇒ Object
1099 1100 1101 1102 |
# File 'lib/zip/zip.rb', line 1099 def == (other) return false unless other.class == ZipStreamableFile @filepath == other.filepath && super(other.delegate) end |
#get_input_stream(&aProc) ⇒ Object
1090 1091 1092 |
# File 'lib/zip/zip.rb', line 1090 def get_input_stream(&aProc) File.open(@filepath, "rb", &aProc) end |
#write_to_zip_output_stream(aZipOutputStream) ⇒ Object
1094 1095 1096 1097 |
# File 'lib/zip/zip.rb', line 1094 def write_to_zip_output_stream(aZipOutputStream) aZipOutputStream.put_next_entry(self) aZipOutputStream << get_input_stream { |is| is.read } end |