Module: FLV::Body::InstanceMethodsWhenString
- Defined in:
- lib/flvedit/flv/body.rb
Instance Method Summary collapse
-
#read_bits(which) ⇒ Object
Returns an
Integer
computed from bits specified bywhich
. -
#read_packed(io, options) ⇒ Object
We need to redefine this, since we want to end up with a Body, not a String.
Instance Method Details
#read_bits(which) ⇒ Object
Returns an Integer
computed from bits specified by which
. The 0th bit is the most significant bit of the first character. which
can designate a range of bits or a single bit
42 43 44 45 46 47 48 49 |
# File 'lib/flvedit/flv/body.rb', line 42 def read_bits(which) # :reading_this => :headache, sorry which = which..which if which.is_a? Integer first_byte, last_byte = which.first >> 3, which.max >> 3 return (getbyte(first_byte) >> (7 & ~which.max)) & ~(~1 << which.max-which.first) if(first_byte == last_byte) mid = last_byte << 3 read_bits(which.first...mid) << (which.max - mid + 1) | read_bits(mid..which.max) end |
#read_packed(io, options) ⇒ Object
We need to redefine this, since we want to end up with a Body, not a String
52 53 54 |
# File 'lib/flvedit/flv/body.rb', line 52 def read_packed(io, ) #:nodoc: replace(io.read(String, )) end |