import IDataOutput from "./IDataOutput"; import IDataInput from "./IDataInput"; import Future from "./Future"; import Endian from "./Endian"; import CompressionAlgorithm from "./CompressionAlgorithm"; import ObjectEncoding from "../net/ObjectEncoding"; declare namespace openfl.utils { export class ByteArray implements IDataOutput, IDataInput { constructor(length?: number); length: number; /** * Returns the byte at index `pos`. * */ get(pos: number): number; /** * Stores the given byte `v` at the given position `pos`. * */ set(pos: number, v: number): void; /** * Copies `len` bytes from `src` into this instance. * @param pos Zero-based location in `this` instance at which to start writing * bytes. * @param src Source `Bytes` instance from which to copy bytes. * @param srcpos Zero-based location at `src` from which bytes will be copied. * @param len Number of bytes to be copied. * */ blit(pos: number, src: any, srcpos: number, len: number): void; /** * Sets `len` consecutive bytes starting from index `pos` of `this` instance * to `value`. * */ fill(pos: number, len: number, value: number): void; /** * Returns a new `Bytes` instance that contains a copy of `len` bytes of * `this` instance, starting at index `pos`. * */ sub(pos: number, len: number): any; /** * Returns `0` if the bytes of `this` instance and the bytes of `other` are * identical. * * Returns a negative value if the `length` of `this` instance is less than * the `length` of `other`, or a positive value if the `length` of `this` * instance is greater than the `length` of `other`. * * In case of equal `length`s, returns a negative value if the first different * value in `other` is greater than the corresponding value in `this` * instance; otherwise returns a positive value. * */ compare(other: any): number; /** * Returns the IEEE double-precision value at the given position `pos` (in * little-endian encoding). Result is unspecified if `pos` is outside the * bounds. * */ getDouble(pos: number): number; /** * Returns the IEEE single-precision value at the given position `pos` (in * little-endian encoding). Result is unspecified if `pos` is outside the * bounds. * */ getFloat(pos: number): number; /** * Stores the given IEEE double-precision value `v` at the given position * `pos` in little-endian encoding. Result is unspecified if writing outside * of bounds. * */ setDouble(pos: number, v: number): void; /** * Stores the given IEEE single-precision value `v` at the given position * `pos` in little-endian encoding. Result is unspecified if writing outside * of bounds. * */ setFloat(pos: number, v: number): void; /** * Returns the 16-bit unsigned integer at the given position `pos` (in * little-endian encoding). * */ getUInt16(pos: number): number; /** * Stores the given 16-bit unsigned integer `v` at the given position `pos` * (in little-endian encoding). * */ setUInt16(pos: number, v: number): void; /** * Returns the 32-bit integer at the given position `pos` (in little-endian * encoding). * */ getInt32(pos: number): number; /** * Stores the given 32-bit integer `v` at the given position `pos` (in * little-endian encoding). * */ setInt32(pos: number, v: number): void; /** * Returns the 64-bit integer at the given position `pos` (in little-endian * encoding). * */ getInt64(pos: number): any; /** * Stores the given 64-bit integer `v` at the given position `pos` (in * little-endian encoding). * */ setInt64(pos: number, v: any): void; /** * Returns the `len`-bytes long string stored at the given position `pos`, * interpreted with the given `encoding` (UTF-8 by default). * */ getString(pos: number, len: number, encoding?: any): string; /** * Returns a `String` representation of the bytes interpreted as UTF-8. * */ toString(): string; /** * Returns a hexadecimal `String` representation of the bytes of `this` * instance. * */ toHex(): string; /** * Returns the bytes of `this` instance as `BytesData`. * */ getData(): any; static get defaultEndian(): Endian; static set defaultEndian(value: Endian) static defaultObjectEncoding: ObjectEncoding; static fromArrayBuffer(buffer: any): ByteArray; static fromBytes(bytes: any): ByteArray; static loadFromBytes(bytes: any): Future; static loadFromFile(path: string): Future; get bytesAvailable(): number; get endian(): Endian; set endian(value: Endian) get objectEncoding(): ObjectEncoding; set objectEncoding(value: ObjectEncoding) position: number; clear(): void; compress(algorithm?: CompressionAlgorithm): void; deflate(): void; inflate(): void; readBoolean(): boolean; readByte(): number; readBytes(bytes: ByteArray, offset?: number, length?: number): void; readDouble(): number; readFloat(): number; readInt(): number; readInt64(): any; readMultiByte(length: number, charSet: string): string; readObject(): any; readShort(): number; readUnsignedByte(): number; readUnsignedInt(): number; readUnsignedShort(): number; readUTF(): string; readLargeUTF(): string; readUTFBytes(length: number): string; uncompress(algorithm?: CompressionAlgorithm): void; writeBoolean(value: boolean): void; writeByte(value: number): void; writeBytes(bytes: ByteArray, offset?: number, length?: number): void; writeDouble(value: number): void; writeFloat(value: number): void; writeInt(value: number): void; writeInt64(value: any): void; writeMultiByte(value: string, charSet: string): void; writeObject(object: any): void; writeShort(value: number): void; writeUnsignedInt(value: number): void; writeUTF(value: string): void; writeLargeUTF(value: string): void; writeUTFBytes(value: string): void; } } export default openfl.utils.ByteArray;