EventMachine::HttpDecoders::GZip

Public Class Methods

encoding_names() click to toggle source
# File lib/em-http/decoders.rb, line 95
def self.encoding_names
  %(gzip compressed)
end

Public Instance Methods

decompress(compressed) click to toggle source
# File lib/em-http/decoders.rb, line 99
def decompress(compressed)
  @buf ||= LazyStringIO.new
  @buf << compressed

  # Zlib::GzipReader loads input in 2048 byte chunks
  if @buf.size > 2048
    @gzip ||= Zlib::GzipReader.new @buf
    @gzip.readline
  end
end
finalize() click to toggle source
# File lib/em-http/decoders.rb, line 110
def finalize
  begin
    @gzip ||= Zlib::GzipReader.new @buf
    @gzip.read
  rescue Zlib::Error
    raise DecoderError
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.