# DataStreamExtensions

> Extension methods for DataStream.

## Definition

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

```csharp
public static class DataStreamExtensions
```

## Static Methods

| Method                                                                                                                                                         | Description                                                                                                                                                                         |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Create](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/datastreamextensions/create.md)                                                     | Initializes a new instance of the DataStreamWriter struct with externally owned memory                                                                                              |
| [GetUnsafeReadOnlyPtr](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/datastreamextensions/getunsafereadonlyptr.md)                         | Get a pointer to the stream's data. Note that the pointer always points at the beginning of the data, no matter how much was read from the stream.                                  |
| [ReadBytesUnsafe](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/datastreamextensions/readbytesunsafe.md)                                   | Read and copy data to the memory location pointed to, an error will be logged if the `length` will put the reader out of bounds on the current read pointer.                        |
| [ReadFixedStringUnsafe](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/datastreamextensions/readfixedstringunsafe.md)                       | Reads a 2-byte length value from the current stream, reads the specified number of bytes to the buffer and advances the current position of the stream by the length of the string. |
| [ReadPackedFixedStringDeltaUnsafe](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/datastreamextensions/readpackedfixedstringdeltaunsafe.md) | Writes a delta FixedString value to the data stream using a [StreamCompressionModel](/engine/6000.7/script-reference/unity/collections/streamcompressionmodel.md).                  |
| [WriteBytesUnsafe](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/datastreamextensions/writebytesunsafe.md)                                 | Appends a specified number of bytes from the buffer to the data stream.                                                                                                             |
