Class: Omnizip::Formats::Rar::BlockParser
- Inherits:
-
Object
- Object
- Omnizip::Formats::Rar::BlockParser
- Includes:
- Constants
- Defined in:
- lib/omnizip/formats/rar/block_parser.rb
Overview
RAR block parser Parses different block types in RAR archives
Constant Summary
Constants included from Constants
Constants::ARCHIVE_AUTH_INFO, Constants::ARCHIVE_COMMENT, Constants::ARCHIVE_ENCRYPTED, Constants::ARCHIVE_FIRST_VOLUME, Constants::ARCHIVE_LOCKED, Constants::ARCHIVE_NEW_NAMING, Constants::ARCHIVE_RECOVERY, Constants::ARCHIVE_SOLID, Constants::ARCHIVE_VOLUME, Constants::BLOCK_ARCHIVE, Constants::BLOCK_COMMENT, Constants::BLOCK_ENDARC, Constants::BLOCK_FILE, Constants::BLOCK_MARKER, Constants::BLOCK_OLD_AUTH, Constants::BLOCK_OLD_EXTRA, Constants::BLOCK_OLD_RECOVERY, Constants::BLOCK_OLD_SUBBLOCK, Constants::BLOCK_SUBBLOCK, Constants::FILE_COMMENT, Constants::FILE_DIRECTORY, Constants::FILE_ENCRYPTED, Constants::FILE_EXT_TIME, Constants::FILE_LARGE, Constants::FILE_SALT, Constants::FILE_SOLID, Constants::FILE_SPLIT_AFTER, Constants::FILE_SPLIT_BEFORE, Constants::FILE_UNICODE, Constants::FILE_VERSION, Constants::METHOD_BEST, Constants::METHOD_FAST, Constants::METHOD_FASTEST, Constants::METHOD_GOOD, Constants::METHOD_NORMAL, Constants::METHOD_STORE, Constants::OS_BEOS, Constants::OS_MACOS, Constants::OS_MSDOS, Constants::OS_OS2, Constants::OS_UNIX, Constants::OS_WIN32, Constants::RAR4_SIGNATURE, Constants::RAR5_FLAG_CHILD_BLOCKS, Constants::RAR5_FLAG_DATA_AREA, Constants::RAR5_FLAG_DATA_INHERITED, Constants::RAR5_FLAG_EXTRA_AREA, Constants::RAR5_FLAG_IS_DIR, Constants::RAR5_FLAG_MULTI_VOLUME, Constants::RAR5_FLAG_UNKNOWN_BLOCKS, Constants::RAR5_HEADER_ENCRYPTION, Constants::RAR5_HEADER_END, Constants::RAR5_HEADER_FILE, Constants::RAR5_HEADER_MAIN, Constants::RAR5_HEADER_SERVICE, Constants::RAR5_SIGNATURE
Instance Attribute Summary collapse
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(version) ⇒ BlockParser
constructor
Initialize block parser.
-
#parse_file_block(io) ⇒ Models::RarEntry?
Parse file block and create entry.
-
#skip_block(io, block_size) ⇒ Object
Skip to next block.
Constructor Details
#initialize(version) ⇒ BlockParser
Initialize block parser
16 17 18 |
# File 'lib/omnizip/formats/rar/block_parser.rb', line 16 def initialize(version) @version = version end |
Instance Attribute Details
#version ⇒ Object (readonly)
Returns the value of attribute version.
11 12 13 |
# File 'lib/omnizip/formats/rar/block_parser.rb', line 11 def version @version end |
Instance Method Details
#parse_file_block(io) ⇒ Models::RarEntry?
Parse file block and create entry
24 25 26 27 28 29 30 |
# File 'lib/omnizip/formats/rar/block_parser.rb', line 24 def parse_file_block(io) if @version == 5 parse_rar5_file_block(io) else parse_rar4_file_block(io) end end |
#skip_block(io, block_size) ⇒ Object
Skip to next block
36 37 38 |
# File 'lib/omnizip/formats/rar/block_parser.rb', line 36 def skip_block(io, block_size) io.read(block_size) if block_size.positive? end |