ArrayBuffer【バイナリデータ配列】オブジェクト
メモ (外部リンク) コンストラクタ プロパティ 一覧 メソッド 一覧 例 (プロパティ)
メモ
概要
- バイナリデータの配列
- 直接の操作は不可
- バイナリデータを高速に扱うためにビューを介して使用
- クラス定義による継承可能
- ビュー
- 参考:その他 配列・コレクション
外部リンク
- ECMA-262 (英語)
ArrayBuffer Objects ES2024 (15) ES2023 (14) ES2022 (13)
コンストラクタ
構文 | 説明 |
---|---|
new ArrayBuffer( length[, options]) | コンストラクタ |
プロパティ 一覧
(下記 例を参照)
プロパティ | 説明 | |
---|---|---|
ArrayBuffer | [ @@species ] | コンストラクタ定義 [Symbol.species] |
ArrayBuffer.prototype | [ @@toStringTag ] | タグ [Symbol.toStringTag] |
ArrayBuffer.prototype. | byteLength | バイトサイズ |
ArrayBuffer.prototype. | constructor | コンストラクタ定義 |
ArrayBuffer. | prototype | プロトタイプ |
ArrayBuffer.prototype. | detached | 切り離し判定 |
ArrayBuffer.prototype. | maxByteLength | 最大バイトサイズ |
ArrayBuffer.prototype. | resizable | サイズ変更可否 |
メソッド 一覧
メソッド | 説明 | |
---|---|---|
ArrayBuffer. | isView( arg ) | ビュー判定 |
ArrayBuffer.prototype. | resize( newLength ) | サイズ変更 |
ArrayBuffer.prototype. | slice( start, end ) | 部分コピー |
ArrayBuffer.prototype. | transfer( [newLength] ) | データ転送 (サイズ変更可) |
ArrayBuffer.prototype. | transferToFixedLength( [newLength] ) | データ転送 (サイズ変更不可) |
例 (プロパティ)
// [ @@species ]
console.log(ArrayBuffer[Symbol.species]);
// 出力:ƒ ArrayBuffer() { [native code] }
console.log(ArrayBuffer.prototype);
// 出力:ArrayBuffer {slice: ƒ, resize: ƒ, …}
const arrayBuffer = new ArrayBuffer(64);
// [ @@toStringTag ]
console.log(arrayBuffer[Symbol.toStringTag]);
// 出力:ArrayBuffer
console.log(arrayBuffer.byteLength);
// 出力:64
console.log(arrayBuffer.constructor);
// 出力:ƒ ArrayBuffer() { [native code] }
console.log(arrayBuffer.maxByteLength);
// 出力:64
console.log(arrayBuffer.resizable);
// 出力:false
console.log(arrayBuffer.detached);
// 出力:false
const arrayBuffer2 = new ArrayBuffer(64, { maxByteLength: 128 });
console.log(arrayBuffer2.byteLength);
// 出力:64
console.log(arrayBuffer2.maxByteLength);
// 出力:128
console.log(arrayBuffer2.resizable);
// 出力:true
console.log(arrayBuffer2.detached);
// 出力:false
arrayBuffer2.resize(96);
console.log(arrayBuffer2.byteLength);
// 出力:96
const arrayBuffer3 = arrayBuffer2.transfer(32);
console.log(arrayBuffer2.detached);
// 出力:true