RingoJS

Module ringo/buffer

A simple text Buffer class for composing strings.

Class Buffer

Instance Methods

Instance Properties


Buffer (args...)

A Buffer class for composing strings. This is implemented as a simple wrapper around a JavaScript array.

Parameters

*... args...

initial parts to write to the buffer


Buffer.prototype. digest (algorithm)

Get a message digest on the content of this buffer.

Parameters

String algorithm

the algorithm to use, defaults to MD5

Returns

String

a Base16 encoded digest


Buffer.prototype. forEach (fn)

Call function fn with each content part in this buffer.

Parameters

Function fn

a function to apply to each buffer part


Buffer.prototype. length

A read-only property containing the number of characters currently contained by this buffer.


Buffer.prototype. reset ()

Reset the buffer discarding all its content.

Returns

Buffer

this buffer object


Buffer.prototype. toString ()

Return the content of this buffer as string.

Returns

String

the buffer as string


Buffer.prototype. write (args...)

Append all arguments to this buffer.

Parameters

*... args...

variable arguments to append to the buffer

Returns

Buffer

this buffer object


Buffer.prototype. writeln (args...)

Append all arguments to this buffer terminated by a carriage return/newline sequence.

Parameters

*... args...

variable arguments to append to the buffer

Returns

Buffer

this buffer object