Sha256: bef14b52c5127465add5fb9c3472a9d5fd32f91cb6064f6c3855592425b6e4df
Contents?: true
Size: 543 Bytes
Versions: 31
Compression:
Stored size: 543 Bytes
Contents
# frozen_string_literal: true module Kafka class GzipCodec def codec_id 1 end def load require "zlib" end def compress(data) buffer = StringIO.new buffer.set_encoding(Encoding::BINARY) writer = Zlib::GzipWriter.new(buffer, Zlib::DEFAULT_COMPRESSION, Zlib::DEFAULT_STRATEGY) writer.write(data) writer.close buffer.string end def decompress(data) buffer = StringIO.new(data) reader = Zlib::GzipReader.new(buffer) reader.read end end end
Version data entries
31 entries across 31 versions & 2 rubygems