Class: Erlang::ETF::BitBinary

Inherits:
Object
  • Object
show all
Includes:
Term
Defined in:
lib/erlang/etf/bit_binary.rb

Overview

1 4 1 Len
77 Len Bits Data

This term represents a bitstring whose length in bits is not a multiple of 8 (created using the bit syntax in R12B and later). The Len field is an unsigned 4 byte integer (big endian). The Bits field is the number of bits that are used in the last byte in the data field, counting from the most significant bit towards the least significant.

(see BIT_BINARY_EXT)

Constant Summary

Constants included from Term

Term::BERT_PREFIX, Term::BIN_LSB_PACK, Term::BIN_MSB_PACK

Instance Method Summary collapse

Methods included from Term

#==, #__erlang_evolve__, #__erlang_type__, #__ruby_evolve__, included

Constructor Details

#initialize(bits, data = "") ⇒ BitBinary

Returns a new instance of BitBinary.



45
46
47
48
# File 'lib/erlang/etf/bit_binary.rb', line 45

def initialize(bits, data = "")
  self.bits = bits
  self.data = data
end

Instance Method Details

#serialize_data(buffer) ⇒ Object



32
33
34
# File 'lib/erlang/etf/bit_binary.rb', line 32

def serialize_data(buffer)
  buffer << data.to_utf8_binary
end