TextEncoder is the interface to encode/decode strings.
TextEncoder is used to define string fields of records.
bre
provides 2 implementations of TextEncoder
.
- Source:
Methods
decode(data, byteOffset, byteLength, encoding) → {string}
Converts the given binary data to the string of the binary data.
Parameters:
Name | Type | Description |
---|---|---|
data |
DataView | the binary data to decode. |
byteOffset |
number | The start index of text data in the data. |
byteLength |
number | The length of text data in the data. |
encoding |
string | The encoding type. |
- Source:
Returns:
Decoded string data.
- Type
- string
encode(text, encoding) → {DataView}
Converts the given string to the binary data of the string.
Parameters:
Name | Type | Description |
---|---|---|
text |
string | The text to encode. |
encoding |
string | The encoding type to encode. |
- Source:
Returns:
Encoded binary data.
- Type
- DataView
encodingExists(value) → {boolean}
Checks whether the given string is a valid encoding type or not.
Parameters:
Name | Type | Description |
---|---|---|
value |
any | The value to check. |
- Source:
Returns:
true
if the value is a valid encoding type.
- Type
- boolean