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



251
252
253
254
# File 'lib/fluent/plugin/in_winevtlog.rb', line 251

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

Instance Method Details

#read_numObject



267
268
269
270
271
# File 'lib/fluent/plugin/in_winevtlog.rb', line 267

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

#read_startObject



261
262
263
264
265
# File 'lib/fluent/plugin/in_winevtlog.rb', line 261

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

#update(start, num) ⇒ Object



256
257
258
259
# File 'lib/fluent/plugin/in_winevtlog.rb', line 256

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