Class: Fluent::Plugin::S3Input::GzipExtractor
Constant Summary
Constants inherited
from Extractor
Extractor::BYTES_TO_READ
Instance Attribute Summary
Attributes inherited from Extractor
#log
Instance Method Summary
collapse
Methods inherited from Extractor
#configure, #initialize
Instance Method Details
#content_type ⇒ Object
449
450
451
|
# File 'lib/fluent/plugin/in_s3.rb', line 449
def content_type
'application/x-gzip'.freeze
end
|
#ext ⇒ Object
445
446
447
|
# File 'lib/fluent/plugin/in_s3.rb', line 445
def ext
'gz'.freeze
end
|
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
|
# File 'lib/fluent/plugin/in_s3.rb', line 456
def (io)
out = ''
loop do
unused = nil
Zlib::GzipReader.wrap(io) do |gz|
while (chunk = gz.read(BYTES_TO_READ))
out << chunk
if out.bytesize > @decompression_size_limit
raise SizeLimitError, "Extracted data exceeds limit of #{@decompression_size_limit} bytes"
end
end
unused = gz.unused
gz.finish
end
io.pos -= unused ? unused.length : 0
break if io.eof?
end
out
ensure
io.close unless io.closed?
end
|