Class: Gzip
- Inherits:
-
Object
- Object
- Gzip
- Defined in:
- lib/fluent/plugin/kinesis_helper/compression.rb
Class Method Summary collapse
- .compress(string, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY) ⇒ Object
- .decompress(string) ⇒ Object
Class Method Details
.compress(string, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/fluent/plugin/kinesis_helper/compression.rb', line 16 def self.compress(string, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY) output = Stream.new gz = Zlib::GzipWriter.new(output, level, strategy) gz.write(string) gz.close output.string end |
.decompress(string) ⇒ Object
24 25 26 |
# File 'lib/fluent/plugin/kinesis_helper/compression.rb', line 24 def self.decompress(string) Zlib::GzipReader.wrap(StringIO.new(string), &:read) end |