toAscii

Encodes a Char to a Byte in ASCII.

Return

the ByteArray representing the Char in ASCII.

Throws

if the character cannot be represented in ASCII. Use Char.toAsciiOrNull to get a non-throwing variant


Encodes a String to a ByteArray using ASCII.

Return

The encoded ByteArray

Parameters

byteOrder

the ByteOrder to use.

Throws

if the string contains a non-ASCII character. Use String.toAsciiOrNull to get a non-throwing variant