Method: PacketGen::PcapNG::UnknownBlock#read

Defined in:
lib/packetgen/pcapng/unknown_block.rb

#read(str_or_io) ⇒ self

Reads a String or a IO to populate the object

Parameters:

  • str_or_io (::String, IO)

Returns:

  • (self)


36
37
38
39
40
41
42
43
44
45
46
# File 'lib/packetgen/pcapng/unknown_block.rb', line 36

def read(str_or_io)
  io = to_io(str_or_io)
  return self if io.eof?

  self[:type].read(io.read(4))
  self[:block_len].read(io.read(4))
  self[:body].read(io.read(self[:block_len].to_i - MIN_SIZE))
  read_blocklen2_and_check(io)

  self
end