class Async::HTTP::BufferedBody

def self.for(body)

def self.for(body)
	chunks = []
	
	body.each do |chunk|
		chunks << chunk
	end
	
	self.new(chunks)
end

def close

def close
	self
end

def each(&block)

def each(&block)
	while @index < @chunks.count
		yield @chunks[@index]
		@index += 1
	end
end

def finished?

def finished?
	true
end

def initialize(chunks)

def initialize(chunks)
	@chunks = chunks
	@index = 0
end

def join

def join
	buffer = Async::IO::BinaryString.new
	
	self.each do |chunk|
		buffer << chunk
	end
	
	return buffer
end

def read

def read
	if chunk = @chunks[@index]
		@index += 1
	end
	
	return chunk
end

def rewind

def rewind
	@index = 0
end