import Coder from "../Coder.js"; import Memory from "../Memory.js"; import DataBuffer from "../DataBuffer.js"; export type Dispatcher = (_?: any) => any; export type DispatcherRecord = Record; export default abstract class Decoder implements Coder { buffer: DataBuffer; cursor: number; memory: Memory; constructor(buffer?: DataBuffer, cursor?: number); reset(): void; decode(): unknown; error(message: string): Error; /** * --- Primitives */ byte(): number; bytes(length: number): DataBuffer; nextByteIs(byte: number): boolean; unknown(): void; character(): number; binary(): Uint8Array; uint8Array(): Uint8Array; uint16Array(): Uint16Array; uint32Array(): Uint32Array; uint8ClampedArray(): Uint8ClampedArray; int8Array(): Int8Array; int16Array(): Int16Array; int32Array(): Int32Array; float32Array(): Float32Array; float64Array(): Float64Array; bigInt64Array(): BigInt64Array; bigUint64Array(): BigUint64Array; arrayBuffer(): ArrayBuffer; dataView(): DataView; boolean(): boolean; regularExpression(): RegExp; date(): Date; any(): any; integer(): number; positiveInteger(): number; bigInteger(): bigint; number(): number; string(): string; /** * --- Constructibles */ nullable(dispatch?: Dispatcher): (this: Decoder) => unknown; tuple(dispatchers: [...Dispatcher[]]): (this: Decoder, constructor?: ArrayConstructor) => [...any]; recall(index: number): (this: Decoder) => any; instance(name: string): (this: Decoder) => unknown; /** * --- Objects */ private isReference; private properties; private reference; object(properties?: DispatcherRecord): (this: Decoder, constructor?: ObjectConstructor) => any; array(dispatch?: Dispatcher, properties?: DispatcherRecord): (this: Decoder, constructor?: ArrayConstructor) => any; set(dispatch?: Dispatcher, properties?: DispatcherRecord): (this: Decoder, constructor?: SetConstructor) => any; map([keyDispatcher, valueDispatcher]: [Dispatcher, Dispatcher], properties?: DispatcherRecord): (this: Decoder, constructor?: MapConstructor) => any; /** * Read the schema's bytes and return a dispatcher */ schema(): Dispatcher; private schemaProperties; }