Class: NMatrix::IO::Matlab::Mat5Reader::RawElement
- Defined in:
- lib/nmatrix/io/mat5_reader.rb
Overview
Doesn’t unpack the contents of the element, e.g., if we want to handle manually, or pass the raw string of bytes into NMatrix.
Instance Attribute Summary
Attributes inherited from Element
Instance Method Summary collapse
Methods inherited from Element
#ignore_padding, #to_ruby, #write_packed
Instance Method Details
#read_packed(packedio, options) ⇒ Object
:nodoc:
560 561 562 563 564 565 566 567 568 569 570 571 572 573 |
# File 'lib/nmatrix/io/mat5_reader.rb', line 560 def read_packed(packedio, ) raise(ArgumentError, 'Missing mandatory option :endian.') unless .has_key?(:endian) self.tag = packedio.read([Tag, {:endian => [:endian] }]) self.data = packedio.read([String, {:endian => [:endian], :bytes => tag.bytes }]) begin ignore_padding(packedio, (tag.bytes + tag.size) % 8) unless [:miMATRIX, :miCOMPRESSED].include?(tag.data_type) rescue EOFError STDERR.puts self.tag.inspect raise ElementDataIOError.new(tag, 'Ignored too much.') end end |