File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -28,9 +28,30 @@ def self.fetcher(remote_file, logger)
2828
2929 class CompressedStreamDownloader < StreamDownloader
3030 def fetch
31- original_file = super
31+ compressed_file_io_object = super
3232 @logger . debug ( "Decompressing gzip file" , :remote_object_key => @remote_object . key )
33- Zlib ::GzipReader . new ( original_file )
33+ decompress_io_object ( compressed_file_io_object )
34+ end
35+
36+ private
37+
38+ def decompress_io_object ( io_object )
39+ # Shelling out is necessary here until logstash-oss is using JRuby 9.4 which includes
40+ # the Zlib::GzipReader.zcat method
41+ output = ''
42+ IO . popen ( 'zcat' , 'r+' ) do |zcat |
43+ writer_thread = Thread . new do
44+ while chunk = io_object . read ( 65536 )
45+ zcat . write ( chunk )
46+ end
47+ zcat . close_write
48+ end
49+
50+ output = zcat . read
51+ writer_thread . join
52+ end
53+
54+ output
3455 end
3556 end
3657end ; end ; end
You can’t perform that action at this time.
0 commit comments