Class: Ronin::Support::Archive::Zip::Reader::Entry
- Inherits:
-
Object
- Object
- Ronin::Support::Archive::Zip::Reader::Entry
- Defined in:
- lib/ronin/support/archive/zip/reader/entry.rb
Overview
Represents an entry in a zip archive.
Instance Attribute Summary collapse
-
#compression ⇒ Integer
readonly
The compression ratio of the file.
-
#crc32 ⇒ String
readonly
The CRC32 checksum (in hex encoding).
-
#date ⇒ Date
readonly
The date of the file.
-
#length ⇒ Integer
readonly
The length of the file.
-
#method ⇒ :stored, :deflate
readonly
The compression method used.
-
#name ⇒ String
readonly
The name of the file.
-
#size ⇒ Integer
readonly
The size of the file.
-
#time ⇒ Time
readonly
The time of the file.
Instance Method Summary collapse
-
#initialize(reader, length:, method:, size:, compression:, date:, time:, crc32:, name:) ⇒ Entry
constructor
private
Initializes the zip archive entry.
-
#read(length = nil) ⇒ String
Reads the contents of the entry.
Constructor Details
#initialize(reader, length:, method:, size:, compression:, date:, time:, crc32:, name:) ⇒ Entry
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the zip archive entry.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/ronin/support/archive/zip/reader/entry.rb', line 97 def initialize(reader, length: , method: , size: , compression: , date: , time: , crc32: , name: ) @reader = reader @length = length @method = method @size = size @compression = compression @date = date @time = time @crc32 = crc32 @name = name end |
Instance Attribute Details
#compression ⇒ Integer (readonly)
The compression ratio of the file.
52 53 54 |
# File 'lib/ronin/support/archive/zip/reader/entry.rb', line 52 def compression @compression end |
#crc32 ⇒ String (readonly)
The CRC32 checksum (in hex encoding).
67 68 69 |
# File 'lib/ronin/support/archive/zip/reader/entry.rb', line 67 def crc32 @crc32 end |
#date ⇒ Date (readonly)
The date of the file.
57 58 59 |
# File 'lib/ronin/support/archive/zip/reader/entry.rb', line 57 def date @date end |
#length ⇒ Integer (readonly)
The length of the file.
37 38 39 |
# File 'lib/ronin/support/archive/zip/reader/entry.rb', line 37 def length @length end |
#method ⇒ :stored, :deflate (readonly)
The compression method used.
42 43 44 |
# File 'lib/ronin/support/archive/zip/reader/entry.rb', line 42 def method @method end |
#name ⇒ String (readonly)
The name of the file.
72 73 74 |
# File 'lib/ronin/support/archive/zip/reader/entry.rb', line 72 def name @name end |
#size ⇒ Integer (readonly)
The size of the file.
47 48 49 |
# File 'lib/ronin/support/archive/zip/reader/entry.rb', line 47 def size @size end |
#time ⇒ Time (readonly)
The time of the file.
62 63 64 |
# File 'lib/ronin/support/archive/zip/reader/entry.rb', line 62 def time @time end |
Instance Method Details
#read(length = nil) ⇒ String
Reads the contents of the entry.
125 126 127 |
# File 'lib/ronin/support/archive/zip/reader/entry.rb', line 125 def read(length=nil) @reader.read(@name, length: length) end |