Class: Omnizip::Buffer::MemoryArchive::Entry
- Inherits:
-
Object
- Object
- Omnizip::Buffer::MemoryArchive::Entry
- Defined in:
- lib/omnizip/buffer/memory_archive.rb
Overview
Entry wrapper with read capability
Wraps underlying ZIP entry to provide consistent interface for reading entry data from the stream.
Instance Attribute Summary collapse
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#compressed_size ⇒ Object
readonly
Returns the value of attribute compressed_size.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
-
#compression_method ⇒ Symbol
Get compression method.
-
#crc32 ⇒ Integer
Get CRC32 checksum.
-
#directory? ⇒ Boolean
Check if entry is a directory.
-
#file? ⇒ Boolean
Check if entry is a file.
-
#initialize(entry, stream) ⇒ Entry
constructor
Initialize entry wrapper.
-
#read(size = nil) ⇒ String?
Read entry content.
Constructor Details
#initialize(entry, stream) ⇒ Entry
Initialize entry wrapper
174 175 176 177 178 179 180 181 182 183 |
# File 'lib/omnizip/buffer/memory_archive.rb', line 174 def initialize(entry, stream) @entry = entry @stream = stream @name = entry.name @size = entry.size @compressed_size = entry.compressed_size @time = entry.time @comment = entry.comment @directory = entry.directory? end |
Instance Attribute Details
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
168 169 170 |
# File 'lib/omnizip/buffer/memory_archive.rb', line 168 def comment @comment end |
#compressed_size ⇒ Object (readonly)
Returns the value of attribute compressed_size.
168 169 170 |
# File 'lib/omnizip/buffer/memory_archive.rb', line 168 def compressed_size @compressed_size end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
168 169 170 |
# File 'lib/omnizip/buffer/memory_archive.rb', line 168 def name @name end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
168 169 170 |
# File 'lib/omnizip/buffer/memory_archive.rb', line 168 def size @size end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
168 169 170 |
# File 'lib/omnizip/buffer/memory_archive.rb', line 168 def time @time end |
Instance Method Details
#compression_method ⇒ Symbol
Get compression method
218 219 220 |
# File 'lib/omnizip/buffer/memory_archive.rb', line 218 def compression_method @entry.compression_method end |
#crc32 ⇒ Integer
Get CRC32 checksum
225 226 227 |
# File 'lib/omnizip/buffer/memory_archive.rb', line 225 def crc32 @entry.crc32 end |
#directory? ⇒ Boolean
Check if entry is a directory
204 205 206 |
# File 'lib/omnizip/buffer/memory_archive.rb', line 204 def directory? @directory end |
#file? ⇒ Boolean
Check if entry is a file
211 212 213 |
# File 'lib/omnizip/buffer/memory_archive.rb', line 211 def file? !@directory end |
#read(size = nil) ⇒ String?
Read entry content
197 198 199 |
# File 'lib/omnizip/buffer/memory_archive.rb', line 197 def read(size = nil) @stream.read(size) end |