Class: Fluent::WinEvtLog::FilePositionEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/in_winevtlog.rb

Constant Summary collapse

START_SIZE =
8
NUM_OFFSET =
9
NUM_SIZE =
8
LN_OFFSET =
17
SIZE =
18

Instance Method Summary collapse

Constructor Details

#initialize(file, seek) ⇒ FilePositionEntry

Returns a new instance of FilePositionEntry.



259
260
261
262
# File 'lib/fluent/plugin/in_winevtlog.rb', line 259

def initialize(file, seek)
  @file = file
  @seek = seek
end

Instance Method Details

#read_numObject



275
276
277
278
279
# File 'lib/fluent/plugin/in_winevtlog.rb', line 275

def read_num
  @file.pos = @seek + NUM_OFFSET
  raw = @file.read(NUM_SIZE)
  raw ? raw.to_i(16) : 0
end

#read_startObject



269
270
271
272
273
# File 'lib/fluent/plugin/in_winevtlog.rb', line 269

def read_start
  @file.pos = @seek
  raw = @file.read(START_SIZE)
  raw ? raw.to_i(16) : 0
end

#update(start, num) ⇒ Object



264
265
266
267
# File 'lib/fluent/plugin/in_winevtlog.rb', line 264

def update(start, num)
  @file.pos = @seek
  @file.write "%08x\t%08x" % [start, num]
end