Class: NMatrix::IO::Matlab::Mat5Reader::Header
- Includes:
- Packable
- Defined in:
- lib/nmatrix/io/mat5_reader.rb
Overview
Internal Classes.
Constant Summary collapse
- BYTE_ORDER_LENGTH =
2
- DESC_LENGTH =
116
- DATA_OFFSET_LENGTH =
8
- VERSION_LENGTH =
2
- BYTE_ORDER_POS =
126
Instance Attribute Summary collapse
-
#data_offset ⇒ Object
Returns the value of attribute data_offset.
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#endian ⇒ Object
Returns the value of attribute endian.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #read_packed(packedio, options) ⇒ Object
-
#write_packed(packedio, options) ⇒ Object
TODO: TEST WRITE.
Instance Attribute Details
#data_offset ⇒ Object
Returns the value of attribute data_offset
422 423 424 |
# File 'lib/nmatrix/io/mat5_reader.rb', line 422 def data_offset @data_offset end |
#desc ⇒ Object
Returns the value of attribute desc
422 423 424 |
# File 'lib/nmatrix/io/mat5_reader.rb', line 422 def desc @desc end |
#endian ⇒ Object
Returns the value of attribute endian
422 423 424 |
# File 'lib/nmatrix/io/mat5_reader.rb', line 422 def endian @endian end |
#version ⇒ Object
Returns the value of attribute version
422 423 424 |
# File 'lib/nmatrix/io/mat5_reader.rb', line 422 def version @version end |
Instance Method Details
#read_packed(packedio, options) ⇒ Object
440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/nmatrix/io/mat5_reader.rb', line 440 def read_packed(packedio, ) self.desc, self.data_offset, self.version, self.endian = packedio >> [String, {:bytes => DESC_LENGTH }] >> [String, {:bytes => DATA_OFFSET_LENGTH }] >> [Integer, {:bytes => VERSION_LENGTH, :endian => [:endian] }] >> [String, {:bytes => 2 }] self.desc.strip! self.data_offset.strip! self.data_offset = nil if self.data_offset.empty? self.endian == 'IM' ? :little : :big end |
#write_packed(packedio, options) ⇒ Object
TODO: TEST WRITE.
433 434 435 436 437 438 |
# File 'lib/nmatrix/io/mat5_reader.rb', line 433 def write_packed(packedio, ) packedio << [desc, {:bytes => DESC_LENGTH }] << [data_offset, {:bytes => DATA_OFFSET_LENGTH }] << [version, {:bytes => VERSION_LENGTH }] << [byte_order, {:bytes => BYTE_ORDER_LENGTH }] end |