Lyricdev
GitHub

class ByteBuffer

pub class ByteBuffer :: [Reader, Writer]

Conforms to Reader, Writer.

A growing buffer of bytes in memory: a Writer that appends, a Reader that takes from the front what was written and not yet read.

Methods

pub static fn new(): ByteBuffer
pub mut fn write(from: Slice<uint8>): int throws IoError

Appends all of from and returns its length; never throws.

pub mut fn read(into: Slice<uint8>): int throws IoError
pub fn toArray(): uint8[]

Returns the bytes it holds, not yet read, in a new array.

pub fn length(): int

Returns how many bytes it holds, not yet read.