Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Copy

Copies a buffer of UCS-2 text. The copy is encoded as UTF-8.
Read time 3 minutesLast updated 10 days ago

Definition

  • Type: Method
  • Namespace: Unity.Collections
  • Assembly: UnityEngine.ManagedKernelModule

Copy(byte*, int, int, char*, int)

Copies a buffer of UCS-2 text. The copy is encoded as UTF-8.
public static CopyError Copy(byte* dest, out int destLength, int destUTF8MaxLengthInBytes, char* src, int srcLength)

Parameters

dest

The destination buffer for writing UTF-8.

destLength

Outputs the number of bytes written to the destination.

destUTF8MaxLengthInBytes

The max number of bytes that will be written to the destination buffer.

The source buffer for reading UCS-2.

srcLength

The number of chars to read from the source.

Returns

Type

Description

CopyErrorCopyError.None if the copy fully completes. Otherwise, returns CopyError.Truncation.

Remarks

Assumes the source data is valid UCS-2.

Copy(byte*, ushort, ushort, char*, int)

Copies a buffer of UCS-2 text. The copy is encoded as UTF-8.
public static CopyError Copy(byte* dest, out ushort destLength, ushort destUTF8MaxLengthInBytes, char* src, int srcLength)

Parameters

dest

The destination buffer for writing UTF-8.

destLength

Outputs the number of bytes written to the destination.

destUTF8MaxLengthInBytes

The max number of bytes that will be written to the destination buffer.

The source buffer for reading UCS-2.

srcLength

The number of chars to read from the source.

Returns

Type

Description

CopyErrorCopyError.None if the copy fully completes. Otherwise, returns CopyError.Truncation.

Remarks

Assumes the source data is valid UCS-2.

Copy(byte*, int, int, byte*, int)

Copies a buffer of UCS-8 text.
public static CopyError Copy(byte* dest, out int destLength, int destUTF8MaxLengthInBytes, byte* src, int srcLength)

Parameters

dest

The destination buffer.

destLength

Outputs the number of bytes written to the destination.

destUTF8MaxLengthInBytes

The max number of bytes that will be written to the destination buffer.

The source buffer.

srcLength

The number of chars to read from the source.

Returns

Type

Description

CopyErrorCopyError.None if the copy fully completes. Otherwise, returns CopyError.Truncation.

Remarks

Assumes the source data is valid UTF-8.

Copy(byte*, ushort, ushort, byte*, ushort)

Copies a buffer of UCS-8 text.
public static CopyError Copy(byte* dest, out ushort destLength, ushort destUTF8MaxLengthInBytes, byte* src, ushort srcLength)

Parameters

dest

The destination buffer.

destLength

Outputs the number of bytes written to the destination.

destUTF8MaxLengthInBytes

The max number of bytes that will be written to the destination buffer.

The source buffer.

srcLength

The number of chars to read from the source.

Returns

Type

Description

CopyErrorCopyError.None if the copy fully completes. Otherwise, returns CopyError.Truncation.

Remarks

Assumes the source data is valid UTF-8.

Copy(char*, int, int, byte*, int)

Copies a buffer of UTF-8 text. The copy is encoded as UCS-2.
public static CopyError Copy(char* dest, out int destLength, int destUCS2MaxLengthInChars, byte* src, int srcLength)

Parameters

dest

The destination buffer for writing UCS-2.

destLength

Outputs the number of chars written to the destination.

destUCS2MaxLengthInChars

The max number of chars that will be written to the destination buffer.

The source buffer for reading UTF-8.

srcLength

The number of bytes to read from the source.

Returns

Type

Description

CopyErrorCopyError.None if the copy fully completes. Otherwise, returns CopyError.Truncation.

Remarks

Assumes the source data is valid UTF-8.

Copy(char*, ushort, ushort, byte*, ushort)

Copies a buffer of UTF-8 text. The copy is encoded as UCS-2.
public static CopyError Copy(char* dest, out ushort destLength, ushort destUCS2MaxLengthInChars, byte* src, ushort srcLength)

Parameters

dest

The destination buffer for writing UCS-2.

destLength

Outputs the number of chars written to the destination.

destUCS2MaxLengthInChars

The max number of chars that will be written to the destination buffer.

The source buffer for reading UTF-8.

srcLength

The number of bytes to read from the source.

Returns

Type

Description

CopyErrorCopyError.None if the copy fully completes. Otherwise, returns CopyError.Truncation.

Remarks

Assumes the source data is valid UTF-8.