Class: EventMachine::HttpDecoders::Deflate

Inherits:
Base
  • Object
show all
Defined in:
lib/em-http/decoders.rb

Instance Method Summary collapse

Methods inherited from Base

#<<, encoding_names, #finalize!, #initialize

Constructor Details

This class inherits a constructor from EventMachine::HttpDecoders::Base

Instance Method Details

#decompress(compressed) ⇒ Object



71
72
73
74
75
76
77
78
# File 'lib/em-http/decoders.rb', line 71

def decompress(compressed)
  begin
    @zstream ||= Zlib::Inflate.new(nil)
    @zstream.inflate(compressed)
  rescue Zlib::Error
    raise DecoderError
  end
end

#finalizeObject



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/em-http/decoders.rb', line 80

def finalize
  return nil unless @zstream

  begin
    r = @zstream.inflate(nil)
    @zstream.close
    r
  rescue Zlib::Error
    raise DecoderError
  end
end