Specifications

When the codec is set to UTF-8, the utility module does not output a BOM. This is the standard
behavior expected by most applications.
When the codec is set to UTF-8BOM, the utility module outputs a 3-byte UTF-8 BOM at the
beginning of the data (this is just a marker to indicate UTF-8 since there are no byte-order issues
in this encoding). Be careful when using this codec, because many applications are not able to
correctly interpret a UTF-8 BOM.
Hex and Base64
Converting between a String and a ByteArray with any of the codecs (except Hex and Base64) is
always unambiguous: the String contains the Unicode code points, the ByteArray contains the
16-bit or 8-bit representation.
With a Hex or Base64 codec, the situation is problematic because:
Both decoded and encoded sides can be represented in 8 bits
Following the logic that “the encoded side is in the ByteArray” (as with the other codecs)
contradicts the frequent use case where “the encoded side is in a String” (for example, part
of an XML stream).
To resolve this issue, the 10 release introduces the following directional codecs:
DescriptionCodec
Map an 8-bit byte stream into the specified 7-bit ASCII representation,
regardless of the source and target data types
toHex toBase64
If the source is a String, only the 8 lowest bits of each Unicode code point
are used (as if latin1 encoding was used)
Map a 7-bit ASCII representation of the specified type into an 8-bit byte
stream, regardless of the source and target data types
fromHex
fromBase64
If the source is a String, only the 8 lowest bits of each Unicode code point
are set and higher bits are cleared (as if latin1 encoding was used)
For compatibility reasons, the unidirectional codecs Hex and Base64 can still be used:
Hex/Base64 will operate as toHex/toBase64 when the target is a ByteArray
Hex/Base64 will operate as fromHex/fromBase64 when target is a String.
ByteArray class
An instance of the ByteArray class represents a sequence of 8-bit bytes (as opposed to Unicode
characters).
Constructors
Constructs a new byte array with the specified number
of bytes and clears all bytes to zero.
ByteArray ( length : Number ) :
ByteArray
An exception is thrown if the specified length is
negative or if it is not an integer.
Constructs a new byte array by concatenating the two
specified parts.
ByteArray ( part1 : ByteArray, part2 :
ByteArray ) : ByteArray
410
Enfocus Switch 10