Class: Harbor::ZippedIO::ZipEntry
- Inherits:
-
Object
- Object
- Harbor::ZippedIO::ZipEntry
- Defined in:
- lib/harbor/zipped_io.rb
Constant Summary collapse
- DEFLATED =
8
- FSTYPE_UNIX =
3
- LOCAL_ENTRY_SIGNATURE =
0x04034b50
- CENTRAL_DIRECTORY_STATIC_HEADER_LENGTH =
46
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#crc ⇒ Object
Returns the value of attribute crc.
-
#file ⇒ Object
Returns the value of attribute file.
-
#name ⇒ Object
Returns the value of attribute name.
-
#size ⇒ Object
Returns the value of attribute size.
Instance Method Summary collapse
- #binary_dos_date ⇒ Object
- #binary_dos_time ⇒ Object
- #central_directory_header_size ⇒ Object
-
#initialize(file) ⇒ ZipEntry
constructor
A new instance of ZipEntry.
- #read_local_entry ⇒ Object
- #time ⇒ Object
Constructor Details
#initialize(file) ⇒ ZipEntry
Returns a new instance of ZipEntry.
147 148 149 150 151 152 153 |
# File 'lib/harbor/zipped_io.rb', line 147 def initialize(file) @file = file @crc = 0 @compressed_size = file.size @size = file.size end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
145 146 147 |
# File 'lib/harbor/zipped_io.rb', line 145 def comment @comment end |
#crc ⇒ Object
Returns the value of attribute crc.
145 146 147 |
# File 'lib/harbor/zipped_io.rb', line 145 def crc @crc end |
#file ⇒ Object
Returns the value of attribute file.
145 146 147 |
# File 'lib/harbor/zipped_io.rb', line 145 def file @file end |
#name ⇒ Object
Returns the value of attribute name.
145 146 147 |
# File 'lib/harbor/zipped_io.rb', line 145 def name @name end |
#size ⇒ Object
Returns the value of attribute size.
145 146 147 |
# File 'lib/harbor/zipped_io.rb', line 145 def size @size end |
Instance Method Details
#binary_dos_date ⇒ Object
155 156 157 |
# File 'lib/harbor/zipped_io.rb', line 155 def binary_dos_date (time.day) + (time.month << 5) + ((time.year - 1980) << 9) end |
#binary_dos_time ⇒ Object
159 160 161 |
# File 'lib/harbor/zipped_io.rb', line 159 def binary_dos_time (time.sec / 2) + (time.min << 5) + (time.hour << 11) end |
#central_directory_header_size ⇒ Object
163 164 165 |
# File 'lib/harbor/zipped_io.rb', line 163 def central_directory_header_size CENTRAL_DIRECTORY_STATIC_HEADER_LENGTH + @file.name.size end |
#read_local_entry ⇒ Object
171 172 173 174 |
# File 'lib/harbor/zipped_io.rb', line 171 def read_local_entry generate unless @data @data end |
#time ⇒ Object
167 168 169 |
# File 'lib/harbor/zipped_io.rb', line 167 def time Time.now end |