Skip to content

BufferList Class Reference

devongovett edited this page Jun 15, 2012 · 8 revisions

A BufferList is, as its name implies, a list of Buffer objects. It manages the current total length of the list and is used by the Stream class internally. When using Aurora, you won't deal with BufferLists directly very often.

new BufferList()

Creates a new BufferList with no data.

BufferList#availableBytes

The current total length of the buffer list.

BufferList#availableBuffers

The number of buffers in the list.

BufferList#first

The first buffer in the list.

BufferList#copy()

Returns a copy of the buffer list with a shallow copy of the buffers. Modifying the buffers in the cloned BufferList will modify the buffers in the original BufferList.

BufferList#push(buffer)

Adds a buffer to the end of the buffer list. Updates availableBytes and availableBuffers.

BufferList#unshift(buffer)

Adds a buffer to the beginning of the buffer list. Updates availableBytes and availableBuffers.

BufferList#shift()

Removes and returns the first buffer in the list, updating availableBytes and availableBuffers accordingly.