Files

Class/Module Index [+]

Quicksearch

BinData::BitAligned

A monkey patch to force byte-aligned primitives to become bit-aligned. This allows them to be used at non byte based boundaries.

class BitString < BinData::String
  bit_aligned
end

class MyRecord < BinData::Record
  bit4       :preamble
  bit_string :str, :length => 2
end

Public Instance Methods

do_num_bytes() click to toggle source
# File lib/bindata/alignment.rb, line 62
def do_num_bytes
  super.to_f
end
do_write(io) click to toggle source
# File lib/bindata/alignment.rb, line 66
def do_write(io)
  value_to_binary_string(_value).each_byte { |v| io.writebits(v, 8, :big) }
end
read_and_return_value(io) click to toggle source
# File lib/bindata/alignment.rb, line 58
def read_and_return_value(io)
  super(BitAlignedIO.new(io))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.