模块 ringo/buffer

用于组成字符串的简单文本缓冲区类。

Class Buffer

Instance Methods

Instance Properties


Buffer (args...)

用于组成字符串的 Buffer 类。这是作为一个 JavaScript 数组的简单包装实现的。

Parameters

*... args...

initial parts to write to the buffer


Buffer.prototype. digest (algorithm)

获取此缓冲区内容的消息摘要。

Parameters

String algorithm

the algorithm to use, defaults to MD5

Returns

String

a Base16 encoded digest


Buffer.prototype. forEach (fn)

用此缓冲区中的每个内容部分调用函数 fn。

Parameters

Function fn

a function to apply to each buffer part


Buffer.prototype. length

包含此缓冲区当前包含的字符数的只读属性。


Buffer.prototype. reset ()

重置放弃所有内容的缓冲区。

Returns

Buffer

this buffer object


Buffer.prototype. toString ()

以字符串形式返回此缓冲区的内容。

Returns

String

the buffer as string


Buffer.prototype. write (args...)

将所有参数追加到此缓冲区。

Parameters

*... args...

variable arguments to append to the buffer

Returns

Buffer

this buffer object


Buffer.prototype. writeln (args...)

将所有参数附加到由回车/换行符序列终止的缓冲区。

Parameters

*... args...

variable arguments to append to the buffer

Returns

Buffer

this buffer object