Class: Mingle::BinReader

Inherits:
BinIoBase
  • Object
show all
Defined in:
lib/mingle.rb

Constant Summary

Constants included from IoConstants

IoConstants::TYPE_CODE_ATOM_TYP, IoConstants::TYPE_CODE_BOOL, IoConstants::TYPE_CODE_BUFFER, IoConstants::TYPE_CODE_DECL_NM, IoConstants::TYPE_CODE_END, IoConstants::TYPE_CODE_ENUM, IoConstants::TYPE_CODE_FLOAT32, IoConstants::TYPE_CODE_FLOAT64, IoConstants::TYPE_CODE_ID, IoConstants::TYPE_CODE_INT32, IoConstants::TYPE_CODE_INT64, IoConstants::TYPE_CODE_LIST, IoConstants::TYPE_CODE_LIST_TYP, IoConstants::TYPE_CODE_MAP_PAIR, IoConstants::TYPE_CODE_NIL, IoConstants::TYPE_CODE_NS, IoConstants::TYPE_CODE_NULLABLE_TYP, IoConstants::TYPE_CODE_QN, IoConstants::TYPE_CODE_RANGE_RESTRICT, IoConstants::TYPE_CODE_REGEX_RESTRICT, IoConstants::TYPE_CODE_STRING, IoConstants::TYPE_CODE_STRUCT, IoConstants::TYPE_CODE_SYM_MAP, IoConstants::TYPE_CODE_TIME_RFC3339

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.as_bin_reader(io_rd) ⇒ Object



2746
2747
2748
# File 'lib/mingle.rb', line 2746

def self.as_bin_reader( io_rd )
    self.send( :new, :rd => io_rd )
end

Instance Method Details

#read_identifierObject



2661
2662
2663
2664
2665
2666
2667
# File 'lib/mingle.rb', line 2661

def read_identifier
    
    expect_type_code( TYPE_CODE_ID )

    parts = Array.new( @rd.read_uint8 ) { buf32_as_utf8 }
    MingleIdentifier.send( :new, :parts => parts )
end

#read_type_referenceObject



2736
2737
2738
2739
2740
2741
2742
2743
2744
# File 'lib/mingle.rb', line 2736

def read_type_reference

    case tc = peek_type_code
    when TYPE_CODE_ATOM_TYP then read_atomic_type_reference
    when TYPE_CODE_LIST_TYP then read_list_type_reference
    when TYPE_CODE_NULLABLE_TYP then read_nullable_type_reference
    else raise errorf( "Unrecognized type reference code: 0x%02x", tc )
    end
end