The stream is closed by the runtime after the response has been + * sent. Implementations should not assume the stream supports + * {@code mark}/{@code reset}.
+ * + *This is a typed alias for {@link #body(Object)} that signals to the + * runtime to use the streaming write path.
+ * + * @param stream the input stream to stream as the response body + * @return this builder + * @since 1.4.0 + */ + default Builder bodyStream(InputStream stream) { + return body(stream); + } + + /** + * Streams the body of the HTTP response via a writer callback. The + * Functions runtime invokes the callback with the response + * {@link OutputStream} once response headers have been sent; the + * function writes its content to the stream and returns. The runtime + * flushes and closes the stream when the callback returns. + * + *Use this overload for server-sent events, chunked responses, or + * any payload that is more naturally produced incrementally than + * materialized as a single {@code byte[]} or {@code InputStream}.
+ * + *This is a typed alias for {@link #body(Object)} that signals to the + * runtime to use the streaming write path.
+ * + * @param writer callback invoked with the response output stream + * @return this builder + * @since 1.4.0 + */ + default Builder bodyStream(IOConsumer