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:
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
# File 'lib/nmatrix/io/mat5_reader.rb', line 582 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 |