Class: AxStream

AxStream()

new AxStream()

Creates a stream object This prototype is meant to be inherited by overriding the following two methods: ReadData(data, size) where data is an ArrayBuffer, size is the amount of bytes to read from the stream into the ArrayBuffer and the return value is the amount of bytes actually read. WriteData(data, size) where data is an ArrayBuffer, size is the amount of bytes to write to the stream from the ArrayBuffer and the return value is the amount of bytes actually written.
Source:

Methods

Dispose()

Explicitly dispose of the resources allocated by the stream
Source:

Read7BitEncodedInt32() → {Integer}

Reads a signed 32 bit integer value of variable size from the stream In the 7-bit encoding, the last bit of each of the bytes of the value represent a flag which denotes whether this is the last byte of the value. This means that the value, if small enough, can be encoded in less than 4 bytes (or 32 bits) A value which uses this encoding practically uses 7 of the total 8 bits of each of its bytes, because the last one is a flag. This encoding potentially saves space for small values, while in the same time gives the ability to have large values as well.
Source:
Returns:
A signed 32 bit integer value read from the stream
Type
Integer

ReadBool() → {Boolean}

Reads a Boolean value from the stream
Source:
Returns:
A Boolean value read from the stream
Type
Boolean

ReadData(destination, size) → {Integer}

Reads data from the memory stream into an ArrayBuffer and returns the number of bytes which were successfully read
Parameters:
Name Type Description
destination ArrayBuffer An array buffer of the appropriate size, into which the read data will be stored
size Integer Number of bytes to read
Source:
Returns:
The number of bytes which were successfully read
Type
Integer

ReadFloat32() → {Number}

Reads a 32 bit floating point value from the stream
Source:
Returns:
A 32 bit floating point value read from the stream
Type
Number

ReadFloat64() → {Number}

Reads a 64 bit floating point value from the stream
Source:
Returns:
A 64 bit floating point value read from the stream
Type
Number

ReadInt8() → {Integer}

Reads a signed byte value from the stream
Source:
Returns:
A signed byte value read from the stream
Type
Integer

ReadInt16() → {Integer}

Reads a signed 16 bit integer value from the stream
Source:
Returns:
A signed 16 bit integer value read from the stream
Type
Integer

ReadInt32() → {Integer}

Reads a signed 32 bit integer value from the stream
Source:
Returns:
A signed 32 bit integer value read from the stream
Type
Integer

ReadInt64() → {Integer}

Reads a signed 64 bit integer value from the stream
Source:
Returns:
A signed 64 bit integer value read from the stream
Type
Integer

ReadString() → {AxString}

Reads a string value from the stream
Source:
Returns:
A string value read from the stream
Type
AxString

ReadUInt8() → {Integer}

Reads an unsigned byte value from the stream
Source:
Returns:
An unsigned byte value read from the stream
Type
Integer

ReadUInt16() → {Integer}

Reads an unsigned 16 bit integer value from the stream
Source:
Returns:
An unsigned 16 bit integer value read from the stream
Type
Integer

ReadUInt32() → {Integer}

Reads an unsigned 32 bit integer value from the stream
Source:
Returns:
An unsigned 32 bit integer value read from the stream
Type
Integer

ReadUInt64() → {Integer}

Reads an unsigned 64 bit integer value from the stream
Source:
Returns:
An unsigned 64 bit integer value read from the stream
Type
Integer

Seek(offset, seekType) → {Boolean}

Seeks number of offset bytes, in a manner determined by a seek type
Parameters:
Name Type Description
offset Integer The offset of seeking is a number of bytes
seekType StreamSeekMode A seeking mode determines how to perform the seek. If omitted, seeking is performed from the beginning of the stream
Source:
Returns:
True if seek was successful, False other wise, if for example it was outside the bounds of the stream
Type
Boolean

Write7BitEncodedInt32(value)

Writes a signed 32 bit integer value of variable size to the stream In the 7-bit encoding, the last bit of each of the bytes of the value represent a flag which denotes whether this is the last byte of the value. This means that the value, if small enough, can be encoded in less than 4 bytes (or 32 bits) A value which uses this encoding practically uses 7 of the total 8 bits of each of its bytes, because the last one is a flag. This encoding potentially saves space for small values, while in the same time gives the ability to have large values as well.
Parameters:
Name Type Description
value Integer The signed 32 bit integer value to be written
Source:

WriteBool(value)

Writes a Boolean value to the stream
Parameters:
Name Type Description
value Boolean The Boolean value to be written
Source:

WriteData(source, size) → {Integer}

Writes data to the memory stream from an ArrayBuffer and returns the number of bytes which were successfully written If writing at a position before the end of the stream, depending on the stream's write mode, new data can either overwite bytes ahead of the position or be inserted - pushing the existing data forward.
Parameters:
Name Type Description
source ArrayBuffer An array buffer which holds the data to be written
size Integer Number of bytes to write
Source:
Returns:
The number of bytes which were successfully written
Type
Integer

WriteFloat32(value)

Writes a 32 bit floating point value to the stream
Parameters:
Name Type Description
value Number The 32 bit floating point value to be written
Source:

WriteFloat64(value)

Writes a 64 bit floating point value to the stream
Parameters:
Name Type Description
value Number The 64 bit floating point value to be written
Source:

WriteInt8(value)

Writes a signed byte value to the stream
Parameters:
Name Type Description
value Integer The signed 8 bit integer value to be written
Source:

WriteInt16(value)

Writes a signed 16 bit integer value to the stream
Parameters:
Name Type Description
value Integer The signed 16 bit integer value to be written
Source:

WriteInt32(value)

Writes a signed 32 bit integer value to the stream
Parameters:
Name Type Description
value Integer The signed 32 bit integer value to be written
Source:

WriteInt64(value)

Writes a signed 64 bit integer value to the stream
Parameters:
Name Type Description
value Integer The signed 64 bit integer value to be written
Source:

WriteStreamData(source, size, maxBufferSize) → {Integer}

Writes data from another stream After the writing is performed, the source stream's location is changed, according to the size of the data which was written
Parameters:
Name Type Description
source AxStream Stream which is the source of the data to write
size Integer Size in bytes of the data to be written
maxBufferSize Integer Maximum size of the buffer to use for the writing. Can be omitted.
Source:
Returns:
The number of bytes actually written
Type
Integer

WriteString(value)

Writes a string value to the stream
Parameters:
Name Type Description
value AxString | String The string value to be written
Source:

WriteUInt8(value)

Writes an unsigned byte value to the stream
Parameters:
Name Type Description
value Integer The unsigned 8 bit integer value to be written
Source:

WriteUInt16(value)

Writes an unsigned 16 bit integer value to the stream
Parameters:
Name Type Description
value Integer The unsigned 16 bit integer value to be written
Source:

WriteUInt32(value)

Writes an unsigned 32 bit integer value to the stream
Parameters:
Name Type Description
value Integer The unsigned 32 bit integer value to be written
Source:

WriteUInt64(value)

Writes an unsigned 64 bit integer value to the stream
Parameters:
Name Type Description
value Integer The unsigned 64 bit integer value to be written
Source:

Documentation generated by JSDoc 3.5.3 on Mon Feb 19 2018 20:39:27 GMT+0200 (FLE Standard Time)