Method: Codec::Base#eval_length

Defined in:
lib/codec/base.rb

#eval_length(buf, length) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/codec/base.rb', line 38

def eval_length(buf,length)
 length = 0 if length.nil?
  if(length != 0)
   if buf.length < length
     raise BufferUnderflow, "Not enough data for parsing #{@id} (#{length}/#{buf.length})"
   end
    return length
  else
    return buf.length
  end
end