Class: EventMachine::HttpDecoders::GZip

### Home Classes Methods

### In Files

- lib/em-http/decoders.rb

### Parent

EventMachine::HttpDecoders::Base

### Methods

- ::encoding_names
- #decompress
- #finalize

### Class/Module Index

Quicksearch

- EventMachine
- EventMachine::HTTPMethods
- EventMachine::HttpClient
- EventMachine::HttpClient::CookieJar
- EventMachine::HttpConnection
- EventMachine::HttpDecoders
- EventMachine::HttpDecoders::Base
- EventMachine::HttpDecoders::DecoderError
- EventMachine::HttpDecoders::Deflate
- EventMachine::HttpDecoders::GZip
- EventMachine::HttpDecoders::GZipHeader
- EventMachine::HttpEncoding
- EventMachine::HttpRequest
- EventMachine::HttpResponseHeader
- EventMachine::HttpStatus
- EventMachine::HttpStubConnection
- EventMachine::Middleware
- EventMachine::Middleware::DigestAuth
- EventMachine::Middleware::JSONResponse
- EventMachine::Middleware::OAuth
- EventMachine::Middleware::OAuth2
- EventMachine::MultiRequest
- HttpClientOptions
- HttpConnectionOptions
- String

No matching classes.

# EventMachine::HttpDecoders::GZip

### Public Class Methods

encoding_names() click to toggle source

    # File lib/em-http/decoders.rb, line 219
    def self.encoding_names
      %(gzip compressed)
    end

### Public Instance Methods

decompress(compressed) click to toggle source

    # File lib/em-http/decoders.rb, line 223
    def decompress(compressed)
      @header ||= GZipHeader.new
      if !@header.finished?
        compressed = @header.extract_stream(compressed)
      end

      @zstream ||= Zlib::Inflate.new(-Zlib::MAX_WBITS)
      @zstream.inflate(compressed)
    rescue Zlib::Error
      raise DecoderError
    end

finalize() click to toggle source

    # File lib/em-http/decoders.rb, line 235
    def finalize
      if @zstream
        if !@zstream.finished?
          r = @zstream.finish
        end
        @zstream.close
        r
      else
        nil
      end
    rescue Zlib::Error
      raise DecoderError
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.