Class: Embulk::Guess::GzipGuessPlugin

Inherits:
Embulk::GuessPlugin show all
Defined in:
lib/embulk/guess/gzip.rb

Constant Summary collapse

GZIP_HEADER =
"\x1f\x8b".force_encoding('ASCII-8BIT').freeze

Instance Method Summary collapse

Methods inherited from Embulk::GuessPlugin

from_java, new_java

Instance Method Details

#guess(config, sample_buffer) ⇒ Object



9
10
11
12
13
14
# File 'lib/embulk/guess/gzip.rb', line 9

def guess(config, sample_buffer)
  if sample_buffer[0,2] == GZIP_HEADER
    return {"decoders" => [{"type" => "gzip"}]}
  end
  return {}
end