dart:typed_data
庫中ByteData.view
的用法介紹如下。
用法:
ByteData.view(
ByteBuffer buffer,
[int offsetInBytes = 0,
int? length]
)
在 buffer
中創建指定區域的 ByteData view
。
ByteData 中的更改將在字節緩衝區中可見,反之亦然。如果未指定區域的offsetInBytes
索引,則默認為零(字節緩衝區中的第一個字節)。如果未提供長度,則視圖將擴展到字節緩衝區的末尾。
offsetInBytes
和 length
必須為非負數,並且 offsetInBytes
+ length
必須小於或等於 buffer
的長度。
請注意,當從 TypedData 列表或字節數據創建視圖時,該列表或字節數據本身可能是較大緩衝區上的視圖,其中 TypedData.offsetInBytes 大於零。僅執行 ByteData.view(other.buffer, 0, count)
可能不會指向您想要的字節。相反,您可能需要這樣做:
ByteData.view(other.buffer, other.offsetInBytes, count)
或者,使用包含此計算的ByteData.sublistView:
ByteData.sublistView(other, 0, count);
(第三個參數是結束索引而不是長度,所以如果從大於零的位置開始,則不需要相應減少計數)。
相關用法
- Dart ByteData用法及代碼示例
- Dart Base64Encoder用法及代碼示例
- Dart BigInt.toRadixString用法及代碼示例
- Dart BigInt.operator_divide用法及代碼示例
- Dart BigInt用法及代碼示例
- Dart BigInt.from用法及代碼示例
- Dart BigInt.isValidInt用法及代碼示例
- Dart BigInt.toDouble用法及代碼示例
- Dart BigInt.parse用法及代碼示例
- Dart BigInt.bitLength用法及代碼示例
- Dart BigInt.gcd用法及代碼示例
- Dart BigInt.operator_truncate_divide用法及代碼示例
- Dart BigInt.tryParse用法及代碼示例
- Dart BigInt.compareTo用法及代碼示例
- Dart BigInt.remainder用法及代碼示例
- Dart BigInt.toInt用法及代碼示例
- Dart BigInt.operator_modulo用法及代碼示例
- Dart BigInt.toUnsigned用法及代碼示例
- Dart BigInt.toString用法及代碼示例
- Dart Base64Decoder用法及代碼示例
- Dart BigInt.pow用法及代碼示例
- Dart BigInt.toSigned用法及代碼示例
- Dart MapMixin.containsKey用法及代碼示例
- Dart Iterator用法及代碼示例
- Dart AttributeClassSet.intersection用法及代碼示例
注:本文由純淨天空篩選整理自dart.dev大神的英文原創作品 ByteData.view constructor。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。