examples/gzip.rb in bindata-0.8.1 vs examples/gzip.rb in bindata-0.9.0
- old
+ new
@@ -7,16 +7,16 @@
extend Forwardable
# Known compression methods
DEFLATE = 8
- class Extra < BinData::Struct
+ class Extra < BinData::MultiValue
uint16le :len, :length => lambda { data.length }
string :data, :read_length => :len
end
- class Header < BinData::Struct
+ class Header < BinData::MultiValue
uint16le :ident, :value => 0x8b1f, :check_value => 0x8b1f
uint8 :compression_method, :initial_value => DEFLATE
uint8 :flags, :value => :calculate_flags_val,
# Upper 3 bits must be zero
:check_value => lambda { (value & 0xe0) == 0 }
@@ -58,10 +58,10 @@
((!clear?(:file_name) ? 1 : 0) << 3) |
((!clear?(:comment) ? 1 : 0) << 4)
end
end
- class Footer < BinData::Struct
+ class Footer < BinData::MultiValue
uint32le :crc32
uint32le :uncompressed_size
end
def initialize