# UnsafeStream.Writer

> Writes data into a buffer of an UnsafeStream.

## Definition

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

```csharp
public struct UnsafeStream.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/lowlevel/unsafe/unsafestream/writer/foreachcount.md) | The number of buffers in the stream of this writer. |

## Methods

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