Skip to content

Stream Class Reference

devongovett edited this page Nov 12, 2012 · 4 revisions

The AV.Stream class represents a stream of binary data backed by a BufferList. Streams handle the complexity of reading various types of values from a binary data stream for you, including issues regarding the native endianness of the platform. Streams are one of the most common pieces of code you will use when writing Aurora decoders.

Constructors

Properties

Methods

Constructors

new AV.Stream(list)

Creates a new AV.Stream with the specified AV.BufferList.

AV.Stream.fromBuffer(buffer)

Returns a new AV.Stream with a new AV.BufferList containing the specified buffer.

Properties

AV.Stream#offset

The current byte offset in the stream.

Methods

AV.Stream#copy()

Returns a new AV.Stream backed by the same data at the same offset.

AV.Stream#available(bytes)

Returns whether the stream has the specified number of bytes available as a boolean.

AV.Stream#remainingBytes()

Returns the number of remaining bytes in the stream.

AV.Stream#advance(bytes)

Advances the current offset of the stream by the specified number of bytes, advancing the buffer list as necessary.

AV.Stream#rewind(bytes)

Rewinds the current offset of the stream by the specified number of bytes, rewinding the buffer list as necessary.

AV.Stream#seek(position)

Advances or rewinds the stream so that the offset is equal to the given position, updating the buffer list as necessary.

AV.Stream#readUInt8()

Returns an unsigned 8 bit integer at the current offset and advances offset.

AV.Stream#peekUInt8(offset = 0)

Returns an unsigned 8 bit integer the specified number of bytes past the current offset without advancing the current offset.

AV.Stream#readInt8()

Returns a signed 8 bit integer at the current offset and advances offset.

AV.Stream#peekInt8(offset = 0)

Returns a signed 8 bit integer the specified number of bytes past the current offset without advancing the current offset.

AV.Stream#readUInt16()

Returns an unsigned 16 bit integer at the current offset and advances offset.

AV.Stream#peekUInt16(offset = 0)

Returns an unsigned 16 bit integer the specified number of bytes past the current offset without advancing the current offset.

AV.Stream#readInt16()

Returns a signed 16 bit integer at the current offset and advances offset.

AV.Stream#peekInt16(offset = 0)

Returns a signed 16 bit integer the specified number of bytes past the current offset without advancing the current offset.

AV.Stream#readUInt24()

Returns an unsigned 24 bit integer at the current offset and advances offset.

AV.Stream#peekUInt24(offset = 0)

Returns an unsigned 24 bit integer the specified number of bytes past the current offset without advancing the current offset.

AV.Stream#readInt24()

Returns a signed 24 bit integer at the current offset and advances offset.

AV.Stream#peekInt24(offset = 0)

Returns a signed 24 bit integer the specified number of bytes past the current offset without advancing the current offset.

AV.Stream#readUInt32()

Returns an unsigned 32 bit integer at the current offset and advances offset.

AV.Stream#peekUInt32(offset = 0)

Returns an unsigned 32 bit integer the specified number of bytes past the current offset without advancing the current offset.

AV.Stream#readInt32()

Returns a signed 32 bit integer at the current offset and advances offset.

AV.Stream#peekInt32(offset = 0)

Returns a signed 32 bit integer the specified number of bytes past the current offset without advancing the current offset.

AV.Stream#readFloat32()

Returns a 32 bit floating point number at the current offset and advances offset.

AV.Stream#peekFloat32(offset = 0)

Returns a 32 bit floating point number the specified number of bytes past the current offset without advancing the current offset.

AV.Stream#readFloat64()

Returns a 64 bit floating point number at the current offset and advances offset.

AV.Stream#peekFloat64(offset = 0)

Returns a 64 bit floating point number the specified number of bytes past the current offset without advancing the current offset.

AV.Stream#readFloat80()

Returns an 80 bit extended floating point number at the current offset and advances offset.

AV.Stream#peekFloat80(offset = 0)

Returns an 80 bit extended floating point number the specified number of bytes past the current offset without advancing the current offset.

AV.Stream#readString(length)

Returns a string containing the specified number of ascii characters after the current offset and advances the current offset.

AV.Stream#peekString(offset, length)

Returns a string containing the specified number of ascii characters, starting at the specified number of bytes past the current offset, without advancing the current offset.

AV.Stream#readBuffer(length, encoding = 'ascii')

Returns a new AV.Buffer containing the specified number of bytes after the current offset. The string is read in the given encoding, which is 'ascii' by default. Allowable encodings are 'ascii', 'utf8', 'utf16-be', 'utf16-le', and 'utf16-bom'.

AV.Stream#peekBuffer(offset, length)

Returns a new AV.Buffer of the specified length, starting at the specified number of bytes after the current offset. The string is read in the given encoding, which is 'ascii' by default. Allowable encodings are 'ascii', 'utf8', 'utf16-be', 'utf16-le', and 'utf16-bom'.

AV.Stream#readSingleBuffer(length)

Returns a new AV.Buffer containing either length bytes or the number of remaining bytes in the current buffer after the current offset, whichever is smaller, and advances the current offset.

AV.Stream#peekSingleBuffer(length)

Returns a new AV.Buffer containing either length bytes or the number of remaining bytes in the current buffer after the current offset, whichever is smaller, without advancing the current offset.

Clone this wiki locally