android-components / mozilla.components.concept.fetch / Request / Body

# Body

`class Body : Closeable` (source)

A Body to be send with the Request.

### Parameters

`stream` - A stream that will be read and send to the resource.

### Constructors

<init> | `Body(stream: InputStream)` A Body to be send with the Request.

### Functions

close | `fun close(): Unit` Closes this body and releases any system resources associated with it.
useStream | `fun <R> useStream(block: (InputStream) -> R): R` Executes the given block function on the body's stream and then closes it down correctly whether an exception is thrown or not.

### Companion Object Functions

fromFile | `fun fromFile(file: File): Body` Create a Body from the provided File.
fromString | `fun fromString(value: String): Body` Create a Body from the provided String.