> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdp.coinbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# FileStream

> Represents a file stream with associated metadata for file uploads.

Package: [`com.coinbase.cdp.core`](/sdks/cdp-sdks-v2/java/com/coinbase/cdp/core/index)

```java theme={null}
public class FileStream extends Object
```

Represents a file stream with associated metadata for file uploads.

## Constructor Details

### `FileStream`

**Overload 1**

```java theme={null}
public FileStream(InputStream inputStream)
```

**Parameters:**

`inputStream` - `InputStream`

**Overload 2**

```java theme={null}
public FileStream(InputStream inputStream, String fileName, okhttp3.MediaType contentType)
```

Constructs a FileStream with the given input stream and optional metadata.

**Parameters:**

`inputStream` (`InputStream`) - The input stream of the file content. Must not be null.

`fileName` (`String`) - The name of the file, or null if unknown.

`contentType` (`okhttp3.MediaType`) - The MIME type of the file content, or null if unknown.

**Throws:**

`[NullPointerException](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/NullPointerException.html "class or interface in java.lang")` - if `inputStream` is null

## Method Details

### `getInputStream`

```java theme={null}
public InputStream getInputStream()
```

**Returns:**

`InputStream`

### `getFileName`

```java theme={null}
public String getFileName()
```

**Returns:**

`String`

### `getContentType`

```java theme={null}
public okhttp3.MediaType getContentType()
```

**Returns:**

`okhttp3.MediaType`

### `toRequestBody`

```java theme={null}
public okhttp3.RequestBody toRequestBody()
```

Creates a RequestBody suitable for use with OkHttp client.

**Returns:**

`okhttp3.RequestBody` - A RequestBody instance representing this file stream.
