@kayahr/text-encoding
Version:
Text encoder and decoder
27 lines (26 loc) • 1.03 kB
TypeScript
import { AbstractDecoder } from "../AbstractDecoder.ts";
import { type ByteBuffer } from "../ByteBuffer.ts";
import type { DecoderConstructor } from "../Decoder.ts";
/**
* Decoder for single byte encodings.
*/
export declare class SingleByteDecoder extends AbstractDecoder {
private readonly index;
/**
* Constructs new decoder for the given code points.
*
* @param codePoints - The code points of the encoding.
* @param fatal - True to throw an exception when a character can't be decoded. False to decode to a
* replacement character instead.
*/
private constructor();
/**
* Creates and returns a single byte decoder class for the given code points.
*
* @param codePoints - The code points of the encoding to decode.
* @returns The created single byte decoder class.
*/
static forCodePoints(codePoints: Array<number | null>): DecoderConstructor;
/** @inheritdoc */
decode(buffer: ByteBuffer): number | number[] | null;
}