Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Member group

Create

Declaring type: HttpStreamContent
Module: System.Web.Http
Assembly: System.Web.dll
Source file: HttpContentTypes.rvn

Overloads / Variants

Create

static func Create(stream: InputStream, length: int, leaveOpen: bool, contentType: MediaType) -> Result<HttpStreamContent, HttpError>

Source file: HttpContentTypes.rvn

Creates a known-length stream with a validated media type.

Parameters

Name Type Description
stream InputStream Source kept open until consumption completes.
length Int32 Exact byte count within the HTTP body limit.
leaveOpen Boolean Whether disposal leaves the source open.
contentType MediaType Content metadata; does not inspect the stream.

Return value

Result<HttpStreamContent, HttpError>

Stream content, InvalidRequest for negative length, or LimitExceeded for excess length.

Remarks

Ownership transfers only on success when leaveOpen is false.

Create

static func Create(stream: InputStream, length: int, leaveOpen: bool) -> Result<HttpStreamContent, HttpError>

Source file: HttpContentTypes.rvn

Creates known-length streaming content without reading its source.

Parameters

Name Type Description
stream InputStream Source kept open until consumption completes.
length Int32 Exact byte count, from zero through the current HTTP body limit.
leaveOpen Boolean Whether disposal leaves the source open.

Return value

Result<HttpStreamContent, HttpError>

Stream content, InvalidRequest for negative length or LimitExceeded for excessive length. Failure leaves ownership with the caller.