Pot.ArrayBufferoid.prototype.read

{Pot.ArrayBufferoid} Pot.ArrayBufferoid.prototype.read ({Number} size)

Pot.js で利用可能。 PotLite.js では利用できません。

ストリーム中の現在の位置から size の分の要素を取得します。

Pot.ArrayBufferoid をストリームとして利用する際の、
現在の位置から size の分の要素を取得します。

取得した要素を持つ 新しい Pot.ArrayBufferoid インスタンスが返ります。

var buffer = new Pot.ArrayBufferoid([1, 2, 3, 4, 5]);
Pot.debug(buffer.tell());  // 0
buffer.seek(1);
Pot.debug(buffer.tell());  // 1
Pot.debug(buffer.read(1)); // [2]
buffer.seek(3);
Pot.debug(buffer.tell());  // 3
Pot.debug(buffer.read(2)); // [4, 5]