UNPKG

sdataview

Version:

A Simple DataView library, to simplify for IO operations on a ArrayBuffer

196 lines (195 loc) 6.37 kB
export default class SDataView { #private; constructor(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number); get [Symbol.toStringTag](): string; /** * Get the internal buffer inside the view */ get buffer(): ArrayBufferLike; /** * Get the byteLength of this SDataView */ get byteLength(): number; /** * Get the offset from which this SDataView starts * Note: This value will not change during read/write operations */ get byteOffset(): number; /** * Get the 32-bit floating point number at this location */ getFloat32(byteOffset: number, littleEndian?: boolean): number; /** * Get the 64-bit floating point number at this location */ getFloat64(byteOffset: number, littleEndian?: boolean): number; /** * Get the 8-bit integer present at this location */ getInt8(byteOffset: number): number; /** * Get the 16-bit integer present at this location */ getInt16(byteOffset: number, littleEndian?: boolean): number; /** * Get the 32-bit integer present at this location */ getInt32(byteOffset: number, littleEndian?: boolean): number; /** * Get the 8-bit unsinged integer present at this location */ getUint8(byteOffset: number): number; /** * Get the 16-bit unsinged integer present at this location */ getUint16(byteOffset: number, littleEndian?: boolean): number; /** * Get the 32-bit unsinged integer present at this location */ getUint32(byteOffset: number, littleEndian?: boolean): number; /** * Set the 32-bit floating point integer present at this location */ setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; /** * Set the 64-bit floating point integer present at this location */ setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; /** * Set the 8-bit integer present at this location */ setInt8(byteOffset: number, value: number): void; /** * Set the 16-bit integer present at this location */ setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; /** * Set the 32-bit integer present at this location */ setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; /** * Set the 8-bit unsinged integer present at this location */ setUint8(byteOffset: number, value: number): void; /** * Set the 16-bit unsinged integer present at this location */ setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; /** * Set the 32-bit unsinged integer present at this location */ setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; /** * Get the 64-bit integer present at this location */ getBigInt64(byteOffset: number, littleEndian?: boolean): bigint; /** * Get the 64-bit unsigned integer present at this location */ getBigUint64(byteOffset: number, littleEndian?: boolean): bigint; /** * Set the 64-bit integer present at this location */ setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void; /** * Set the 64-bit unsinged integer present at this location */ setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void; /** * I/O: This will return the internal I/O Offset */ get ioOffset(): number; /** * Determines whether the values larget than 8-bit must be read in little-endian byte-order * @default true */ isLittleEndian: boolean; /** * T/O: Resets the internal I/O Offset */ reset(): void; /** * Creates a new sub-SDataView with the same underlying Buffer */ subview(byteOffset: number, byteLength?: number): SDataView; /** * I/O: Read a 32-bit floating point number and move the internal I/O Offset */ readFloat32(): number | null; /** * I/O: Read a 64-bit floating point and move the internal I/O Offset */ readFloat64(): number | null; /** * I/O: Read a 8-bit integer and move the internal I/O Offset */ readInt8(): number | null; /** * I/O: Read a 16-bit integer and move the internal I/O Offset */ readInt16(): number | null; /** * I/O: Read a 32-bit integer and move the internal I/O Offset */ readInt32(): number | null; /** * I/O: Read a 8-bit unsigned integer and move the internal I/O Offset */ readUint8(): number | null; /** * I/O: Read a 16-bit unsigned integer and move the internal I/O Offset */ readUint16(): number | null; /** * I/O: Read a 32-bit unsigned integer and move the internal I/O Offset */ readUint32(): number | null; /** * I/O: Write a 32-bit floating point number and move the internal I/O Offset */ writeFloat32(value: number): void; /** * I/O: Write a 64-bit floating point and move the internal I/O Offset */ writeFloat64(value: number): void; /** * I/O: Write a 8-bit integer and move the internal I/O Offset */ writeInt8(value: number): void; /** * I/O: Write a 16-bit integer and move the internal I/O Offset */ writeInt16(value: number): void; /** * I/O: Write a 32-bit integer and move the internal I/O Offset */ writeInt32(value: number): void; /** * I/O: Write a 8-bit unsigned integer and move the internal I/O Offset */ writeUint8(value: number): void; /** * I/O: Write a 16-bit unsigned integer and move the internal I/O Offset */ writeUint16(value: number): void; /** * I/O: Write a 32-bit unsigned integer and move the internal I/O Offset */ writeUint32(value: number): void; /** * I/O: Read a 64-bit integer and move the internal I/O Offset */ readBigInt64(): bigint | null; /** * I/O: Read a 64-bit unsigned integer and move the internal I/O Offset */ readBigUint64(): bigint | null; /** * I/O: Write a 64-bit integer and move the internal I/O Offset */ writeBigInt64(value: bigint): void; /** * I/O: Write a 64-bit unsigned integer and move the internal I/O Offset */ writeBigUint64(value: bigint): void; }