Class UTF8ArrayUnsafeUtility
Provides methods for copying and encoding Unicode text.
Namespace: Unity.Collections
Syntax
public static class UTF8ArrayUnsafeUtility : object
Methods
Append(Byte*, ref UInt16, UInt16, Byte*, UInt16)
Appends UTF-8 text to a buffer.
Declaration
public static CopyError Append(byte *dest, ref ushort destLength, ushort destUTF8MaxLengthInBytes, byte *src, ushort srcLength)
Parameters
| Type | Name | Description |
|---|---|---|
| Byte* | dest | The destination buffer. |
| UInt16 | destLength | Reference to the destination buffer's length in bytes before the append. Will be assigned the number of bytes appended. |
| UInt16 | destUTF8MaxLengthInBytes | The destination buffer's length in bytes. Data will not be appended past this length. |
| Byte* | src | The source buffer. |
| UInt16 | srcLength | The number of bytes to read from the source. |
Returns
| Type | Description |
|---|---|
| CopyError | None if the append fully completes. Otherwise, returns Truncation. |
Remarks
Assumes the source data is valid UTF-8.
Append(Byte*, ref UInt16, UInt16, Char*, Int32)
Appends UCS-2 text to a buffer, encoded as UTF-8.
Declaration
public static CopyError Append(byte *dest, ref ushort destLength, ushort destUTF8MaxLengthInBytes, char *src, int srcLength)
Parameters
| Type | Name | Description |
|---|---|---|
| Byte* | dest | The destination buffer. |
| UInt16 | destLength | Reference to the destination buffer's length in bytes before the append. Will be assigned the number of bytes appended. |
| UInt16 | destUTF8MaxLengthInBytes | The destination buffer's length in bytes. Data will not be appended past this length. |
| Char* | src | The source buffer. |
| Int32 | srcLength | The number of chars to read from the source. |
Returns
| Type | Description |
|---|---|
| CopyError | None if the append fully completes. Otherwise, returns Truncation. |
Remarks
Assumes the source data is valid UCS-2.
Append(Char*, ref UInt16, UInt16, Byte*, UInt16)
Appends UTF-8 text to a buffer, encoded as UCS-2.
Declaration
public static CopyError Append(char *dest, ref ushort destLength, ushort destUCS2MaxLengthInChars, byte *src, ushort srcLength)
Parameters
| Type | Name | Description |
|---|---|---|
| Char* | dest | The destination buffer. |
| UInt16 | destLength | Reference to the destination buffer's length in chars before the append. Will be assigned the number of chars appended. |
| UInt16 | destUCS2MaxLengthInChars | The destination buffer's length in chars. Data will not be appended past this length. |
| Byte* | src | The source buffer. |
| UInt16 | srcLength | The number of bytes to read from the source. |
Returns
| Type | Description |
|---|---|
| CopyError | None if the append fully completes. Otherwise, returns Truncation. |
Remarks
Assumes the source data is valid UTF-8.
AppendUTF8Bytes(Byte*, ref Int32, Int32, Byte*, Int32)
Appends UTF-8 text to a buffer.
Declaration
public static FormatError AppendUTF8Bytes(byte *dest, ref int destLength, int destCapacity, byte *src, int srcLength)
Parameters
| Type | Name | Description |
|---|---|---|
| Byte* | dest | The destination buffer. |
| Int32 | destLength | Reference to the destination buffer's length in bytes before the append. Will be assigned the new length after the append. |
| Int32 | destCapacity | The destination buffer capacity in bytes. |
| Byte* | src | The source buffer. |
| Int32 | srcLength | The number of bytes to read from the source. |
Returns
| Type | Description |
|---|---|
| FormatError | None if the append fully completes. Otherwise, returns |