class Protocol::HTTP::Body::Writable::Output

The output interface for writing chunks to the body.

def close(error = nil)

@parameter error [Exception | Nil] The error that caused this stream to be closed, if any.

If an error is given, the error will be used to close the body by invoking {close} with the error. Otherwise, only the write side of the body will be closed.

Close the output stream.
def close(error = nil)
	@closed = true
	
	if error
		@writable.close(error)
	else
		@writable.close_write
	end
end

def closed?

@returns [Boolean] Whether the output is closed for writing only.
def closed?
	@closed || @writable.closed?
end

def initialize(writable)

@parameter writable [Writable] The writable body.

Initialize the output with the given writable body.
def initialize(writable)
	@writable = writable
	@closed = false
end

def write(chunk)

Write a chunk to the body.
def write(chunk)
	@writable.write(chunk)
end