Encoding
12 Sep 20251 minute to read
Encoding class: Contains the details about encoding type, whether to write a Unicode byte order mark (BOM).
let encoding : Encoding = new Encoding();
encoding.type = 'Utf8';
encoding.getBytes('Encoding', 0, 5);Properties
includeBom boolean
Gets a value indicating whether to write a Unicode byte order mark
type EncodingType
Gets the encoding type.
Methods
destroy
To clear the encoding instance
Returns void
getByteCount
Calculates the number of bytes produced by encoding the characters in the specified string
| Parameter | Type | Description |
|---|---|---|
| chars | string |
The string containing the set of characters to encode |
Returns number
getBytes
Encodes a set of characters from the specified string into the ArrayBuffer.
Returns ArrayBuffer
getString
Decodes a sequence of bytes from the specified ArrayBuffer into the string.
Returns string