Class: BinData::Peek
- Inherits:
-
BasePrimitive
- Object
- BasePrimitive
- BinData::Peek
- Includes:
- ClassParametersPlugin
- Defined in:
- lib/binproxy/bd_util.rb
Instance Method Summary collapse
- #initialize_instance ⇒ Object
- #read_and_return_value(io) ⇒ Object
- #sensible_default ⇒ Object
- #value_to_binary_string(val) ⇒ Object
Methods included from ClassParametersPlugin
Methods inherited from BasePrimitive
Instance Method Details
#initialize_instance ⇒ Object
176 177 178 |
# File 'lib/binproxy/bd_util.rb', line 176 def initialize_instance @proto = get_parameter :type end |
#read_and_return_value(io) ⇒ Object
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/binproxy/bd_util.rb', line 184 def read_and_return_value(io) #TODO - make this work rather than punting on it if io.instance_eval {@rnbits} > 0 raise "cannot peek when not byte aligned!" end obj = get_parameter(:type).instantiate(nil,self) io = io.raw_io pos = io.pos begin obj.read(io) ensure io.pos = pos end obj end |
#sensible_default ⇒ Object
204 205 206 |
# File 'lib/binproxy/bd_util.rb', line 204 def sensible_default 0 end |
#value_to_binary_string(val) ⇒ Object
180 181 182 |
# File 'lib/binproxy/bd_util.rb', line 180 def value_to_binary_string(val) '' end |