@kayahr/text-encoding
Version:
Text encoder and decoder
23 lines (22 loc) • 843 B
TypeScript
import { ByteBuffer } from "./ByteBuffer.js";
import { Decoder } from "./Decoder.js";
/**
* Base class for decoders.
*/
export declare abstract class AbstractDecoder implements Decoder {
protected readonly fatal: boolean;
/**
* @param fatal - True to throw an exception when a character can't be decoded. False to decode to a
* replacement character instead.
*/
constructor(fatal?: boolean);
/**
* Fails the decoding by throwing an exception (if fatal flag is true) or returning a replacement character.
*
* @return Replacement character to use for the character which could not be decoded.
* @throws TypeError - When fatal flag is set to true.
*/
protected fail(): number;
/** @inheritDoc */
abstract decode(buffer: ByteBuffer): number | number[] | null;
}