copyEncodedStringIntoArray

fun Encoding.copyEncodedStringIntoArray(string: String, array: ByteArray, offset: Int = 0, byteOrder: ByteOrder): ByteArray

Encodes a String using the given Encoding and ByteOrder and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

string

the String to encode.

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

byteOrder

Throws

if array is not is not large enough to hold Encoding.byteSize bytes at the offset.