This class is used to wrap a byte[] of any size and use it as a fixed size buffer. Main goal is to reuse byte[] objects multiple times as the automatic garbage collection of byte[] can cause unity games to stall or reduce framerate.
More...
|
| | ByteArrayBuffer (byte[] arr) |
| | Creates a byte buffer without using the global bool / without reusing an existing byte[].
|
| |
| | ByteArrayBuffer (byte[] arr, int offset, int length) |
| | Creates a byte buffer without using the global bool / without reusing an existing byte[].
|
| |
| void | CopyFrom (byte[] arr, int srcOffset, int len) |
| | Copies the data into the buffer. Offset and length are assumed to fit.
|
| |
|
void | Dispose () |
| | Returns the buffer back to its pool if it was created via Get.
|
| |
|
| static ByteArrayBuffer | Get (int size, bool enforceZeroOffset=false) |
| | Allocates a new buffer. It won't use the exact size but often a larger one to be able to reuse it later efficiently. Call Dispose after being done with the buffer.
|
| |
|
|
byte[] | array |
| | Array used by this buffer.
|
| |
|
|
static bool | LOG_GC_CALLS = false |
| | Debugging flag only.
|
| |
|
|
int | PositionWriteRelative [get, set] |
| | Used to keep track of the "end" position / length of the content in this buffer.
|
| |
|
int | PositionWriteAbsolute [get, set] |
| | Length + Offset of the buffer.
|
| |
|
int | PositionReadRelative [get] |
| | Keeps track of the current read position / length (relative to the offset)
|
| |
|
int | PositionReadAbsolute [get] |
| | Index of the read position starting on array[0] not array[offset].
|
| |
| int | Offset [get] |
| | Offset of the content in this buffer. Can be used to truncate leading bytes without having to reallocate the whole byte array (not yet used. Always 0. This might change if more optimization is needed for some C# / C++ interaction)
|
| |
| byte[] | Buffer [get] |
| | Returns a reference to the internal buffer.
|
| |
| int | ContentLength [get, set] |
| | Length of the content in the buffer. Samme as PositionWriteRelative but used for MessageDataBuffer interface.
|
| |
|
bool | IsDisposed [get] |
| | Checks if the buffer was disposed. For debugging.
|
| |
This class is used to wrap a byte[] of any size and use it as a fixed size buffer. Main goal is to reuse byte[] objects multiple times as the automatic garbage collection of byte[] can cause unity games to stall or reduce framerate.
Watch out this class is being used to help with C# / C++ interaction and allow direct pointer access to the byte[]. Changes can easily cause crashes or very difficult to debug memory errors on different platforms.
◆ ByteArrayBuffer() [1/2]
| Byn.Awrtc.ByteArrayBuffer.ByteArrayBuffer |
( |
byte[] | arr | ) |
|
Creates a byte buffer without using the global bool / without reusing an existing byte[].
- Parameters
-
◆ ByteArrayBuffer() [2/2]
| Byn.Awrtc.ByteArrayBuffer.ByteArrayBuffer |
( |
byte[] | arr, |
|
|
int | offset, |
|
|
int | length ) |
Creates a byte buffer without using the global bool / without reusing an existing byte[].
- Parameters
-
◆ CopyFrom()
| void Byn.Awrtc.ByteArrayBuffer.CopyFrom |
( |
byte[] | arr, |
|
|
int | srcOffset, |
|
|
int | len ) |
Copies the data into the buffer. Offset and length are assumed to fit.
- Parameters
-
◆ Get()
| static ByteArrayBuffer Byn.Awrtc.ByteArrayBuffer.Get |
( |
int | size, |
|
|
bool | enforceZeroOffset = false ) |
|
static |
Allocates a new buffer. It won't use the exact size but often a larger one to be able to reuse it later efficiently. Call Dispose after being done with the buffer.
- Parameters
-
- Returns
◆ Buffer
| byte [] Byn.Awrtc.ByteArrayBuffer.Buffer |
|
get |
◆ ContentLength
| int Byn.Awrtc.ByteArrayBuffer.ContentLength |
|
getset |
◆ Offset
| int Byn.Awrtc.ByteArrayBuffer.Offset |
|
get |
Offset of the content in this buffer. Can be used to truncate leading bytes without having to reallocate the whole byte array (not yet used. Always 0. This might change if more optimization is needed for some C# / C++ interaction)
Implements Byn.Awrtc.MessageDataBuffer.
The documentation for this class was generated from the following file:
- /Volumes/macdev/wrtc/main_new/awrtc/awrtc_cs_common/Byn.Awrtc/ByteArrayBuffer.cs