Interface OutputStreamBodyWriter


public interface OutputStreamBodyWriter
Use to set the body content using a callback that writes to an OutputStream.

This allows streaming large or dynamically generated content directly to the HTTP request body, without buffering the entire payload in memory. The provided OutputStreamWriter is called with an OutputStream that writes to the request body. Data written to the stream is sent as the request body.

Example usage:


   client.request()
     .url("http://example.com/upload")
     .body(outputStream -> {
       // Write data in chunks
       for (byte[] chunk : getChunks()) {
         outputStream.write(chunk);
       }
     })
     .POST()
     .asPlainString();
 
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    write(OutputStream outputStream)
    Write body content to the outputStream.