Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ByteArray

Hierarchy

  • ByteArray

Index

Constructors

constructor

Properties

buffer

buffer: Buffer

endian

objectEncoding

objectEncoding: number

position

position: number

shareable

shareable: boolean

Static Private BUFFER_SIZE

BUFFER_SIZE: number

Accessors

bytesAvailable

  • get bytesAvailable(): number

length

  • get length(): number
  • set length(value: number): void

Methods

atomicCompareAndSwapIntAt

  • atomicCompareAndSwapIntAt(byteIndex: number, expectedValue: number, newValue: number): number
  • In a single atomic operation, compares an number value in this byte array with another number value and, if they match, swaps those bytes with another value.

    Parameters

    • byteIndex: number
    • expectedValue: number
    • newValue: number

    Returns number

atomicCompareAndSwapLength

  • atomicCompareAndSwapLength(expectedLength: number, newLength: number): number
  • In a single atomic operation, compares this byte array's length with a provided value and, if they match, changes the length of this byte array.

    Parameters

    • expectedLength: number
    • newLength: number

    Returns number

clear

  • clear(): void
  • Clears the contents of the byte array and resets the length and position properties to 0. Calling this method explicitly frees up the memory used by the ByteArray instance.

    Returns void

compress

  • compress(algorithm?: CompressionAlgorith): void
  • Compresses the byte array. The entire byte array is compressed. After the call, the length property of the ByteArray is set to the new length. The position property is set to the end of the byte array.

    Parameters

    • Default value algorithm: CompressionAlgorith = CompressionAlgorith.Zlib

    Returns void

deflate

  • deflate(): void
  • Compresses the byte array using the deflate compression algorithm. The entire byte array is compressed.

    Returns void

inflate

  • inflate(): void
  • Decompresses the byte array using the deflate compression algorithm. The byte array must have been compressed using the same algorithm.

    Returns void

readBoolean

  • readBoolean(): boolean
  • Reads a Boolean value from the byte stream. A single byte is read, and true is returned if the byte is nonzero, false otherwise.

    Returns boolean

readByte

  • readByte(): number
  • Reads a signed byte from the byte stream.

    Returns number

readBytes

  • readBytes(bytes: ByteArray, offset?: number, length?: number): void
  • Reads the number of data bytes, specified by the length parameter, from the byte stream. The bytes are read into the ByteArray object specified by the bytes parameter, and the bytes are written into the destination ByteArray starting at the position specified by offset.

    Parameters

    • bytes: ByteArray
    • Default value offset: number = 0
    • Optional length: number

    Returns void

readDouble

  • readDouble(): number
  • Reads an IEEE 754 double-precision (64-bit) floating-point number from the byte stream.

    Returns number

readFloat

  • readFloat(): number
  • Reads an IEEE 754 single-precision (32-bit) floating-point number from the byte stream.

    Returns number

readInt

  • readInt(): number
  • Reads a signed 32-bit integer from the byte stream.

    Returns number

readMultiByte

  • readMultiByte(length: number, charSet?: string): string
  • Reads a multibyte string of specified length from the byte stream using the specified character set.

    Parameters

    • length: number
    • Optional charSet: string

    Returns string

readObject

  • readObject(): any
  • Reads an object from the byte array, encoded in AMF serialized format.

    Returns any

readShort

  • readShort(): number
  • Reads a signed 16-bit integer from the byte stream.

    Returns number

readUTF

  • readUTF(): string
  • Reads a UTF-8 string from the byte stream. The string is assumed to be prefixed with an unsigned short indicating the length in bytes.

    Returns string

readUTFBytes

  • readUTFBytes(length: number): string
  • Reads a sequence of UTF-8 bytes specified by the length parameter from the byte stream and returns a string.

    Parameters

    • length: number

    Returns string

readUnsignedByte

  • readUnsignedByte(): number
  • Reads an unsigned byte from the byte stream.

    Returns number

readUnsignedInt

  • readUnsignedInt(): number
  • Reads an unsigned 32-bit integer from the byte stream.

    Returns number

readUnsignedShort

  • readUnsignedShort(): number
  • Reads an unsigned 16-bit integer from the byte stream

    Returns number

toJSON

  • toJSON(k: string): any
  • Provides an overridable method for customizing the JSON encoding of values in an ByteArray object.

    Parameters

    • k: string

    Returns any

toString

  • toString(encoding?: string, offset?: number, length?: number): string
  • Converts the byte array to a string. If the data in the array begins with a Unicode byte order mark, the application will honor that mark when converting to a string. If System.useCodePage is set to true, the application will treat the data in the array as being in the current system code page when converting.

    Parameters

    • Optional encoding: string
    • Optional offset: number
    • Optional length: number

    Returns string

uncompress

  • uncompress(algorithm?: CompressionAlgorith): void
  • Decompresses the byte array. After the call, the length property of the ByteArray is set to the new length. The position property is set to 0.

    Parameters

    • Default value algorithm: CompressionAlgorith = CompressionAlgorith.Zlib

    Returns void

Private updatePosition

  • updatePosition(n: number): number
  • Update position with number after use it

    Parameters

    • n: number

    Returns number

writeBoolean

  • writeBoolean(value: boolean): number
  • Writes a Boolean value.

    Parameters

    • value: boolean

    Returns number

writeByte

  • writeByte(value: number): number
  • Writes a byte to the byte stream.

    Parameters

    • value: number

    Returns number

writeBytes

  • writeBytes(bytes: ByteArray, offset?: number, length?: number): void
  • Writes a sequence of length bytes from the specified byte array, bytes, starting offset(zero-based index) bytes into the byte stream.

    Parameters

    • bytes: ByteArray
    • Default value offset: number = 0
    • Optional length: number

    Returns void

writeDouble

  • writeDouble(value: number): number
  • Writes an IEEE 754 double-precision (64-bit) floating-point number to the byte stream.

    Parameters

    • value: number

    Returns number

writeFloat

  • writeFloat(value: number): number
  • Writes an IEEE 754 single-precision (32-bit) floating-point number to the byte stream.

    Parameters

    • value: number

    Returns number

writeInt

  • writeInt(value: number): number
  • Writes a 32-bit signed integer to the byte stream.

    Parameters

    • value: number

    Returns number

writeMultiByte

  • writeMultiByte(value: string, charSet?: string): number
  • Writes a multibyte string to the byte stream using the specified character set.

    Parameters

    • value: string
    • Optional charSet: string

    Returns number

writeObject

  • writeObject(object: any): void
  • Writes an object into the byte array in AMF serialized format.

    Parameters

    • object: any

    Returns void

writeShort

  • writeShort(value: number): number
  • Writes a 16-bit integer to the byte stream.

    Parameters

    • value: number

    Returns number

writeUTF

  • writeUTF(value: string): number
  • Writes a UTF-8 string to the byte stream.

    Parameters

    • value: string

    Returns number

writeUTFBytes

  • writeUTFBytes(value: string): number
  • Writes a UTF-8 string to the byte stream.

    Parameters

    • value: string

    Returns number

writeUnsignedByte

  • writeUnsignedByte(value: number): number
  • Writes a 8-bit unsigned integer to the byte stream.

    Parameters

    • value: number

    Returns number

writeUnsignedInt

  • writeUnsignedInt(value: number): number
  • Writes a 32-bit unsigned integer to the byte stream.

    Parameters

    • value: number

    Returns number

writeUnsignedShort

  • writeUnsignedShort(value: number): number
  • Writes a 16-bit unsigned integer to the byte stream.

    Parameters

    • value: number

    Returns number

Generated using TypeDoc