//#region src/common/bin/lib0/decoding.d.ts
/**
 * Original at https://github.com/dmonad/lib0
 *
 * Efficient schema-less binary decoding with support for variable length encoding.
 *
 * Use [lib0/decoding] with [lib0/encoding]. Every encoding function has a corresponding decoding function.
 *
 * Encodes numbers in little-endian order (least to most significant byte order)
 * and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/)
 * which is also used in Protocol Buffers.
 *
 * ```js
 * // encoding step
 * const encoder = new encoding.createEncoder()
 * encoding.writeVarUint(encoder, 256)
 * encoding.writeVarString(encoder, 'Hello world!')
 * const buf = encoding.toUint8Array(encoder)
 * ```
 *
 * ```js
 * // decoding step
 * const decoder = new decoding.createDecoder(buf)
 * decoding.readVarUint(decoder) // => 256
 * decoding.readVarString(decoder) // => 'Hello world!'
 * decoding.hasContent(decoder) // => false - all data is read
 * ```
 */
/**
 * A BinDecoder handles the decoding of an Uint8Array.
 */
declare class BinDecoder {
  /** Decoding target. */
  arr: Uint8Array;
  /** Current decoding position. */
  pos: number;
  constructor(uint8Array: Uint8Array);
}
declare function createDecoder(uint8Array: Uint8Array): BinDecoder;
declare function hasContent(decoder: BinDecoder): boolean;
/**
 * Clone a decoder instance.
 * Optionally set a new position parameter.
 */
declare function clone(decoder: BinDecoder, newPos?: number): BinDecoder;
/**
 * Create an Uint8Array view of the next `len` bytes and advance the position by `len`.
 *
 * Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks.
 *            Use `buffer.copyUint8Array` to copy the result into a new Uint8Array.
 */
declare function readUint8Array(decoder: BinDecoder, len: number): Uint8Array;
/**
 * Read unsigned integer (32bit) with variable length.
 * 1/8th of the storage is used as encoding overhead.
 * numbers < 2^7 is stored in one bytlength
 * numbers < 2^14 is stored in two bylength
 */
declare function readVarUint(decoder: BinDecoder): number;
/**
 * Read variable length Uint8Array.
 *
 * Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks.
 *            Use `buffer.copyUint8Array` to copy the result into a new Uint8Array.
 */
declare function readVarUint8Array(decoder: BinDecoder): Uint8Array;
/**
 * Read the rest of the content as an ArrayBuffer
 */
declare function readTailAsUint8Array(decoder: BinDecoder): Uint8Array;
/**
 * Skip one byte, jump to the next position.
 */
declare function skip8(decoder: BinDecoder): number;
/**
 * Read one byte as unsigned integer.
 */
declare function readUint8(decoder: BinDecoder): number;
/**
 * Read 2 bytes as unsigned integer.
 */
declare function readUint16(decoder: BinDecoder): number;
/**
 * Read 4 bytes as unsigned integer.
 */
declare function readUint32(decoder: BinDecoder): number;
/**
 * Read 4 bytes as unsigned integer in big endian order.
 * (most significant byte first)
 */
declare function readUint32BigEndian(decoder: BinDecoder): number;
/**
 * Look ahead without incrementing the position
 * to the next byte and read it as unsigned integer.
 */
declare function peekUint8(decoder: BinDecoder): number;
/**
 * Look ahead without incrementing the position
 * to the next byte and read it as unsigned integer.
 */
declare function peekUint16(decoder: BinDecoder): number;
/**
 * Look ahead without incrementing the position
 * to the next byte and read it as unsigned integer.
 */
declare function peekUint32(decoder: BinDecoder): number;
/**
 * Read signed integer (32bit) with variable length.
 * 1/8th of the storage is used as encoding overhead.
 * numbers < 2^7 is stored in one bytlength
 * numbers < 2^14 is stored in two bylength
 * @todo This should probably create the inverse ~num if number is negative - but this would be a breaking change.
 */
declare function readVarInt(decoder: BinDecoder): number;
/**
 * Look ahead and read varUint without incrementing position
 */
declare function peekVarUint(decoder: BinDecoder): number;
/**
 * Look ahead and read varUint without incrementing position
 */
declare function peekVarInt(decoder: BinDecoder): number;
/**
 * Read string of variable length
 * varUint is used to store the length of the string
 */
declare function readVarString(decoder: BinDecoder): string;
/**
 * Look ahead and read varString without incrementing position
 */
declare function peekVarString(decoder: BinDecoder): string;
declare function readFromDataView(decoder: BinDecoder, len: number): DataView;
declare function readFloat32(decoder: BinDecoder): number;
declare function readFloat64(decoder: BinDecoder): number;
declare function readBigInt64(decoder: BinDecoder): bigint;
declare function readBigUint64(decoder: BinDecoder): bigint;
declare function readAny(decoder: BinDecoder): any;
//#endregion
export { BinDecoder, clone, createDecoder, hasContent, peekUint16, peekUint32, peekUint8, peekVarInt, peekVarString, peekVarUint, readAny, readBigInt64, readBigUint64, readFloat32, readFloat64, readFromDataView, readTailAsUint8Array, readUint16, readUint32, readUint32BigEndian, readUint8, readUint8Array, readVarInt, readVarString, readVarUint, readVarUint8Array, skip8 };
//# sourceMappingURL=decoding.d.cts.map