writeMutf8Array

@JvmName(name = "writeArrayTo")
fun OutputStream.writeMutf8Array(characters: CharArray, startIndex: Int = 0, endIndex: Int = characters.size, bytesPerWrite: Int = DEFAULT_BYTES_PER_WRITE)(source)

Creates a StreamMutf8Sink around the receiver, writes the mutf8Length of the characters, and then writes the characters themselves.

In code, that would be:

val mutf8Length = characters.mutf8Length(startIndex, endIndex)
val sink = StreamMutf8Sink(stream = this, bytesPerWrite)
sink.writeLength(mutf8Length)
sink.writeFromArray(characters, startIndex, endIndex)

See the documentation for those methods (linked below) for their limitations, exceptions, parameters, and their meanings.

See also


fun OutputStream.writeMutf8Array(characters: CharArray, range: IntRange = 0..characters.lastIndex, bytesPerWrite: Int = DEFAULT_BYTES_PER_WRITE)(source)

Creates a StreamMutf8Sink around the receiver, writes the mutf8Length of the characters, and then writes the characters themselves.

In code, that would be:

val mutf8Length = characters.mutf8Length(startIndex = range.first, endIndex = range.last + 1)
val sink = StreamMutf8Sink(stream = this, bytesPerWrite)
sink.writeLength(mutf8Length)
sink.writeFromArray(characters, range)

See the documentation for those methods (linked below) for their limitations, exceptions, parameters, and their meanings.

See also