/** * A class for reading EO data from a sequence of bytes. * *
`EoReader` features a chunked reading mode, which is important for accurate emulation of * the official game client. * * @see {@link https://github.com/Cirras/eo-protocol/blob/master/docs/chunks.md | Chunked Reading} */ export declare class EoReader { private readonly data; private _position; private _chunkedReadingMode; private chunkStart; private nextBreak; /** * Creates a new `EoReader` instance for the specified data. * * @param data - the byte array containing the input data */ constructor(data: Uint8Array); /** * Creates a new `EoReader` whose input data is a shared subsequence of this reader's data. * *
The input data of the new reader will start at position `index` in this reader and contain * up to `length` bytes. The two reader's position and chunked reading mode will be independent. * *
The new reader's position will be zero, and its chunked reading mode will be false.
*
* @param [index] - the position in this reader at which the data of the new reader will start;
* must be non-negative. Defaults to the current reader position.
* @param [length] - the length of the shared subsequence of data to supply to the new reader;
* must be non-negative. Defaults to the length of the remaining data starting from `index`.
* @throws `Error` if `index` or `length` is negative.
* This exception will **not** be thrown if `index + length` is greater than the size of the
* input data. Consistent with the existing over-read behaviors, the new reader will be
* supplied a shared subsequence of all remaining data starting from `index`.
* @returns The new reader
*/
slice(index?: number, length?: number): EoReader;
/**
* Reads a raw byte from the input data.
*
* @returns A raw byte
*/
getByte(): number;
/**
* Reads an array of raw bytes from the input data.
*
* @returns An array of raw bytes
*/
getBytes(length: number): Uint8Array;
/**
* Reads an encoded 1-byte integer from the input data.
*
* @returns A decoded 1-byte integer
*/
getChar(): number;
/**
* Reads an encoded 2-byte integer from the input data.
*
* @returns A decoded 2-byte integer
*/
getShort(): number;
/**
* Reads an encoded 3-byte integer from the input data.
*
* @returns A decoded 3-byte integer
*/
getThree(): number;
/**
* Reads an encoded 4-byte integer from the input data.
*
* @returns A decoded 4-byte integer
*/
getInt(): number;
/**
* Reads a string from the input data.
*
* @returns A string
*/
getString(): string;
/**
* Reads a string with a fixed length from the input data.
*
* @param length - the length of the string
* @param padded - true if the string is padded with trailing `0xFF` bytes
* @returns A decoded string
* @throws `Error` if the length is negative
*/
getFixedString(length: number, padded?: boolean): string;
/**
* Reads an encoded string from the input data.
*
* @returns A decoded string
*/
getEncodedString(): string;
/**
* Reads an encoded string with a fixed length from the input data.
*
* @param length - the length of the string
* @param padded - true if the string is padded with trailing `0xFF` bytes
* @returns A decoded string
* @throws `Error` if the length is negative
*/
getFixedEncodedString(length: number, padded?: boolean): string;
/**
* Sets the chunked reading mode for the reader.
*
*
In chunked reading mode: * *