class IO::Stream::Generic

def write(string, flush: false)

@returns [Integer] the number of bytes appended to the buffer.
@parameter string [String] the string to write to the buffer.
buffer is flushed to the underlying `io`.
Writes `string` to the buffer. When the buffer is full or #sync is true the
def write(string, flush: false)
	@writing.synchronize do
		@write_buffer << string
		
		flush |= (@write_buffer.bytesize >= @block_size)
		
		if flush
			self.drain(@write_buffer)
		end
	end
	
	return string.bytesize
end