class Async::HTTP::Body::Readable

A generic base class for wrapping body instances. Typically you’d override ‘#read`.

def close(error = nil)

The consumer can call stop to signal that the stream output has terminated.
def close(error = nil)
end

def each

Enumerate all chunks until finished, then invoke `#close`.
def each
	while chunk = self.read
		yield chunk
		# chunk.clear
	end
ensure
	self.close($!)
end

def empty?

Will read return any data?
def empty?
	false
end

def finish

Read all remaining chunks into a buffered body and close the underlying input.
def finish
	# Internally, this invokes `self.each` which then invokes `self.close`.
	Buffered.for(self)
end

def join

Read all remaining chunks into a single binary string using `#each`.
def join
	buffer = IO::Buffer.new
	
	self.each do |chunk|
		buffer << chunk
		chunk.clear
	end
	
	return buffer
end

def length

def length
	nil
end

def read

Read the next available chunk.
def read
	nil
end