class Protocol::HTTP::Body::Inflate
Public Class Methods
for(body, encoding = GZIP)
click to toggle source
# File lib/protocol/http/body/inflate.rb, line 31 def self.for(body, encoding = GZIP) self.new(body, Zlib::Inflate.new(encoding)) end
Public Instance Methods
read()
click to toggle source
Calls superclass method
# File lib/protocol/http/body/inflate.rb, line 35 def read return if @stream.finished? # The stream might have been closed while waiting for the chunk to come in. if chunk = super @input_length += chunk.bytesize # It's possible this triggers the stream to finish. chunk = @stream.inflate(chunk) @output_length += chunk.bytesize elsif !@stream.closed? chunk = @stream.finish @output_length += chunk.bytesize end if chunk.empty? and @stream.finished? return nil end return chunk end