TextDecoder

Text Decoder

TextDecoder is part of the Encoding API (in JavaScript), and is responsible for decoding byte streams into strings using a specific character encoding.

The TextDecoder interface represents a decoder for a specific method, that is a specific character encoding, like UTF-8, ISO-8859-2, KOI8, etc.

 

Summary

Text decoders can be created anywhere within the JavaScript context, as the class is installed at the TextDecoder symbol within the global namespace.

Inheritors

Types

Link copied to clipboard

Specifies options for calls to TextDecoder.decode.

Link copied to clipboard
object Defaults

Constant defaults used in the JavaScript Encoding API.

Link copied to clipboard

Models constructor methods for TextDecoder instances; such objects can be constructed with no parameters, with an optional "label" (the encoding to decode from), and a set of options.

Link copied to clipboard
data class Options : Record

Specifies options for TextDecoder instances; instances of these options can be provided to the TextDecoder constructor to specify how the decoder should behave.

Properties

Link copied to clipboard
abstract val encoding: String

Specifies the encoding implemented by this utility instance.

Link copied to clipboard

Provides host-side access to TextDecoder options.

Functions

Link copied to clipboard
open fun decode(): String
open fun decode(buffer: Value?): String

Decodes a byte stream into a string.

abstract fun decode(stream: InputStream): String

Decodes an input stream of bytes into a string.

abstract fun decode(buffer: ByteBuffer): String

Consumes and decodes an input buffer of bytes to a string.

abstract fun decode(channel: ReadableByteChannel): String

Consumes and decodes an input channel into a string.

abstract fun decode(bytes: ByteArray): String

Decodes a byte array into a string.

abstract fun decode(buffer: ByteBuffer, options: TextDecoder.DecodeOptions? = null): String

Decodes a ByteBuffer using the provided options and this text decoder's assigned encoding.

abstract fun decode(buffer: Value, options: TextDecoder.DecodeOptions): String

Decodes a byte stream into a string, potentially with options; this method is for host-side dispatch only.

open fun decode(buffer: Value?, options: Value?): String

Decodes a byte stream into a string, potentially with options.

Link copied to clipboard
abstract fun getMember(key: String): Any
Link copied to clipboard
open override fun getMemberKeys(): Array<String>
Link copied to clipboard
open override fun hasMember(key: String?): Boolean
Link copied to clipboard
open override fun putMember(key: String?, value: Value?)
Link copied to clipboard
open override fun removeMember(key: String?): Boolean