Class BinaryReaderExtensions
Extensions for the BinaryReader class. These extensions provide methods for reading strings and byte arrays from a binary reader.
Inherited Members
Namespace: UnityEngine.TestTools.Graphics
Assembly: UnityEngine.TestTools.Graphics.dll
Syntax
public static class BinaryReaderExtensions
Methods
GetBytes(BinaryReader)
Reads a byte array from the binary reader. The byte array is read as a length-prefixed array. The length of the array is read as an integer, followed by the byte array itself.
Declaration
public static byte[] GetBytes(this BinaryReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| BinaryReader | reader | The binary reader to read the byte array from. |
Returns
| Type | Description |
|---|---|
| byte[] | The byte array read from the binary reader. If the length is -1, null is returned. |
GetString(BinaryReader, Encoding)
Reads a string from the binary reader.
Declaration
public static string GetString(this BinaryReader reader, Encoding encoding = null)
Parameters
| Type | Name | Description |
|---|---|---|
| BinaryReader | reader | The binary reader to read the string from. |
| Encoding | encoding | The encoding to use for the string. |
Returns
| Type | Description |
|---|---|
| string | The string read from the binary reader. If the length is -1, null is returned. |