# NativeStream.Writer

> Writes data into a buffer of a NativeStream.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule

```csharp
public struct NativeStream.Writer
```

## Remarks

An individual writer can only be used for one buffer of one stream. Do not create more than one writer for an individual buffer.

## Properties

| Property                                                                                              | Description                                         |
| ----------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| [ForEachCount](/engine/6000.7/script-reference/unity/collections/nativestream/writer/foreachcount.md) | The number of buffers in the stream of this writer. |

## Methods

| Method                                                                                                          | Description                                                        |
| --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| [Allocate](/engine/6000.7/script-reference/unity/collections/nativestream/writer/allocate.md)                   | Allocate space in a buffer.                                        |
| [BeginForEachIndex](/engine/6000.7/script-reference/unity/collections/nativestream/writer/beginforeachindex.md) | Readies this writer to write to a particular buffer of the stream. |
| [EndForEachIndex](/engine/6000.7/script-reference/unity/collections/nativestream/writer/endforeachindex.md)     | Readies the buffer written by this writer for reading.             |
| [PatchMinMaxRange](/engine/6000.7/script-reference/unity/collections/nativestream/writer/patchminmaxrange.md)   | For internal use only.                                             |
| [Write](/engine/6000.7/script-reference/unity/collections/nativestream/writer/write.md)                         | Write a value to a buffer.                                         |
