How can I help you?
Encoding
6 Feb 20262 minutes 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
Get includeBom boolean
Gets a value indicating whether to write a Unicode byte order mark.
Get type EncodingType
Gets the encoding type.
Set type void
Sets the encoding type.
| Parameter | Type | Description |
|---|---|---|
| value | EncodingType |
The encoding type to set. |
Methods
destroy
Clears 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.
| Parameter | Type | Description |
|---|---|---|
| s | string |
The string containing the set of characters to encode. |
| charIndex | number |
The index of the first character to encode. |
| charCount | number |
The number of characters to encode. |
Returns ArrayBuffer
getString
Decodes a sequence of bytes from the specified ArrayBuffer into a string.
| Parameter | Type | Description |
|---|---|---|
| bytes | ArrayBuffer |
The ArrayBuffer containing the sequence of bytes to decode. |
| index | number |
The index of the first byte to decode. |
| count | number |
The number of bytes to decode. |
Returns string