Class: CPIO::ASCIIReader
- Inherits:
-
Object
- Object
- CPIO::ASCIIReader
- Defined in:
- lib/excavate/extractors/cpio/cpio.rb
Constant Summary collapse
- FIELD_SIZES =
{ :magic => 6, :ino => 8, :mode => 8, :uid => 8, :gid => 8, :nlink => 8, :mtime => 8, :filesize => 8, :devmajor => 8, :devminor => 8, :rdevmajor => 8, :rdevminor => 8, :namesize => 8, :check => 8 }
- HEADER_LENGTH =
FIELD_SIZES.reduce(0) { |m, (_, v)| m + v }
- HEADER_PACK =
FIELD_SIZES.collect { |_, v| "A#{v}" }.join
- FIELD_ORDER =
[ :magic, :ino, :mode, :uid, :gid, :nlink, :mtime, :filesize, :devmajor, :devminor, :rdevmajor, :rdevminor, :namesize, :check ]
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(io) ⇒ ASCIIReader
constructor
A new instance of ASCIIReader.
Constructor Details
#initialize(io) ⇒ ASCIIReader
Returns a new instance of ASCIIReader.
71 72 73 |
# File 'lib/excavate/extractors/cpio/cpio.rb', line 71 def initialize(io) @io = io end |
Instance Method Details
#each(&block) ⇒ Object
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/excavate/extractors/cpio/cpio.rb', line 81 def each(&block) while true entry = read break if entry.nil? # The CPIO format has the end-of-stream marker as a file called "TRAILER!!!" break if entry.name == "TRAILER!!!" block.call(entry, entry.file) verify_correct_read(entry) unless entry.directory? end end |