xcom2charpool
Version:
Library for reading, manipulating, and managing XCOM 2 character pool binary files, supporting both browser and Node.js environments.
44 lines (43 loc) • 1.37 kB
TypeScript
import { Writer } from '../Writer';
/** Implementation based on browser's DataView */
export declare class ArrayBufferWriter implements Writer {
#private;
position: number;
constructor(initialSize?: number);
/**
* Ensures the internal buffer has enough capacity to write additional bytes.
*/
private ensureCapacity;
/**
* Writes a 32-bit unsigned integer at the current position.
*/
uint32(value: number): this;
/**
* Writes a 32-bit signed integer at the current position.
*/
int32(value: number): this;
/**
* Writes a byte at the current position.
*/
byte(value: number): this;
/**
* Writes padding (4 zero bytes) at the current position.
*/
padding(): this;
/**
* Encodes a string into a Uint8Array using UTF-16LE encoding.
*/
private encodeUTF16LE;
private encodeASCII;
/**
* Writes a string with a length prefix and null-termination.
* Automatically detects the encoding based on the characters used.
* Uses UTF-8 for ASCII strings and UTF-16LE for strings with non-ASCII characters.
*/
string(value: string): this;
/**
* Retrieves the underlying buffer up to the current length of data written.
* @returns A sliced ArrayBuffer containing the written data.
*/
getBuffer(): ArrayBuffer;
}