class Gzip

Public Class Methods

compress(string, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY) click to toggle source
# 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) click to toggle source
# File lib/fluent/plugin/kinesis_helper/compression.rb, line 24
def self.decompress(string)
  Zlib::GzipReader.wrap(StringIO.new(string), &:read)
end