Class: FilesHunter::Decoder

Inherits:
Object
  • Object
show all
Defined in:
lib/fileshunter/Decoder.rb,
ext/fileshunter/Decoders/_FLAC.c

Overview

Generic Decode class All Decoders inherit from this class and have to implement the find_segments method, using @data, @begin_offset and @end_offset instance variables to parse data. Here is the DSL Decoders can use in their find_segments method:

  • @data (IOBlockReader): The data to be accessed
  • @begin_offset (Fixnum): The begin offset
  • @end_offset (Fixnum): The end offset
  • found_segment: Method used to indicate a Segment was successfully parsed
  • keep_alive: Method used to indicate progression

Instance Method Summary collapse

Instance Method Details

#segments_foundObject

Return found segments since last setup

Result
  • list: The list of segments


32
33
34
# File 'lib/fileshunter/Decoder.rb', line 32

def segments_found
  return @segments
end

#setup(segments_analyzer, data, begin_offset, end_offset) ⇒ Object

Prepare for new search

Parameters
  • segments_analyzer (SegmentsAnalyzer): The segments analyzer for which this Decoder is working
  • data (IOBlockReader): Data being analyzed
  • begin_offset (Fixnum): The begin offset
  • end_offset (Fixnum): The end offset


20
21
22
23
24
25
26
# File 'lib/fileshunter/Decoder.rb', line 20

def setup(segments_analyzer, data, begin_offset, end_offset)
  @segments_analyzer = segments_analyzer
  @data = data
  @begin_offset = begin_offset
  @end_offset = end_offset
  @segments = []
end