Class: shaka.util.StringUtils

A set of string utility functions.

Source:

Methods

(static) fromBytesAutoDetect(datanullable) → {string}

Creates a string from the given buffer, auto-detecting the encoding that is being used. If it cannot detect the encoding, it will throw an exception.
Parameters:
Name Type Attributes Description
data BufferSource <nullable>
Source:
Throws:
Returns:
Type
string

(private, static) fromCharCode_(argsnon-null) → {string}

Creates a new string from the given array of char codes.
Parameters:
Name Type Description
args TypedArray
Source:
Returns:
Type
string

(static) fromUTF8(datanullable) → {string}

Creates a string from the given buffer as UTF-8 encoding.
Parameters:
Name Type Attributes Description
data BufferSource <nullable>
Source:
Throws:
Returns:
Type
string

(static) fromUTF16(datanullable, littleEndian, opt_noThrowopt) → {string}

Creates a string from the given buffer as UTF-16 encoding.
Parameters:
Name Type Attributes Description
data BufferSource <nullable>
littleEndian boolean true to read little endian, false to read big.
opt_noThrow boolean <optional>
true to avoid throwing in cases where we may expect invalid input. If noThrow is true and the data has an odd length, it will be truncated.
Source:
Throws:
Returns:
Type
string

(static) toUTF8(str) → (non-null) {ArrayBuffer}

Creates a ArrayBuffer from the given string, converting to UTF-8 encoding.
Parameters:
Name Type Description
str string
Source:
Returns:
Type
ArrayBuffer