Class: shaka.util.StringUtils

A set of string utility functions.

Members

fromCharCodeImpl_ :shaka.util.Lazy.<function(!TypedArray): string>

Type:
Source:

Methods

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:
Returns:
Type
string

fromCharCode(arraynon-null) → {string}

Creates a new string from the given array of char codes. Using String.fromCharCode.apply is risky because you can trigger stack errors on very large arrays. This breaks up the array into several pieces to avoid this.
Parameters:
Name Type Description
array TypedArray
Source:
Returns:
Type
string

fromUTF8(datanullable) → {string}

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

fromUTF16(datanullable, littleEndian, 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.
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:
Returns:
Type
string

resetFromCharCode()

Resets the fromCharCode method's implementation. For debug use.
Source:

toUTF8(str) → {ArrayBuffer}

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

toUTF16(str, littleEndian) → {ArrayBuffer}

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