A sequence of bytes underlying a typed data object. Used to process large quantities of binary or numerical data more efficiently using a typed view.
Returns the length of this byte buffer, in bytes.
A fixed-length, random-access sequence of bytes that also provides random and unaligned access to the fixed-width integers and floating point numbers represented by those bytes. ByteData may be used to pack and unpack data from external sources (such as networks or files systems), and to process large quantities of numerical data more efficiently than would be possible with ordinary List
implementations. ByteData can save space, by eliminating the need for object headers, and time, by eliminating the need for data copies. Finally, ByteData may be used to intentionally reinterpret the bytes representing one arithmetic type as another. For example this code fragment determine what 32-bit signed integer is represented by the bytes of a 32-bit floating point number:
var buffer = new Uint8List(8).buffer; var bdata = new ByteData.view(buffer); bdata.setFloat32(0, 3.04); int huh = bdata.getInt32(0);
Creates a ByteData
of the specified length (in elements), all of whose elements are initially zero.
Creates an ByteData
_view_ of the specified region in the specified byte buffer. Changes in the ByteData
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.
Returns the floating point number represented by the four bytes at the specified byteOffset
in this object, in IEEE 754 single-precision binary floating-point format (binary32).
Throws RangeError
if byteOffset
is negative, or byteOffset + 4
is greater than the length of this object.
Returns the floating point number represented by the eight bytes at the specified byteOffset
in this object, in IEEE 754 double-precision binary floating-point format (binary64).
Throws RangeError
if byteOffset
is negative, or byteOffset + 8
is greater than the length of this object.
Returns the (possibly negative) integer represented by the two bytes at the specified byteOffset
in this object, in two's complement binary form. The return value will be between 2<sup>15</sup> and 2<sup>15</sup> - 1, inclusive.
Throws RangeError
if byteOffset
is negative, or byteOffset + 2
is greater than the length of this object.
Returns the (possibly negative) integer represented by the four bytes at the specified byteOffset
in this object, in two's complement binary form. The return value will be between 2<sup>31</sup> and 2<sup>31</sup> - 1, inclusive.
Throws RangeError
if byteOffset
is negative, or byteOffset + 4
is greater than the length of this object.
Returns the (possibly negative) integer represented by the eight bytes at the specified byteOffset
in this object, in two's complement binary form. The return value will be between 2<sup>63</sup> and 2<sup>63</sup> - 1, inclusive.
Throws RangeError
if byteOffset
is negative, or byteOffset + 8
is greater than the length of this object.
Returns the (possibly negative) integer represented by the byte at the specified byteOffset
in this object, in two's complement binary representation. The return value will be between -128 and 127, inclusive.
Throws RangeError
if byteOffset
is negative, or greater than or equal to the length of this object.
Returns the positive integer represented by the two bytes starting at the specified byteOffset
in this object, in unsigned binary form. The return value will be between 0 and 2<sup>16</sup> - 1, inclusive.
Throws RangeError
if byteOffset
is negative, or byteOffset + 2
is greater than the length of this object.
Returns the positive integer represented by the four bytes starting at the specified byteOffset
in this object, in unsigned binary form. The return value will be between 0 and 2<sup>32</sup> - 1, inclusive.
Returns the positive integer represented by the eight bytes starting at the specified byteOffset
in this object, in unsigned binary form. The return value will be between 0 and 2<sup>64</sup> - 1, inclusive.
Throws RangeError
if byteOffset
is negative, or byteOffset + 8
is greater than the length of this object.
Returns the positive integer represented by the byte at the specified byteOffset
in this object, in unsigned binary form. The return value will be between 0 and 255, inclusive.
Throws RangeError
if byteOffset
is negative, or greater than or equal to the length of this object.
Sets the four bytes starting at the specified byteOffset
in this object to the IEEE 754 single-precision binary floating-point (binary32) representation of the specified value
.
Note that this method can lose precision. The input value
is a 64-bit floating point value, which will be converted to 32-bit floating point value by IEEE 754 rounding rules before it is stored. If value
cannot be represented exactly as a binary32, it will be converted to the nearest binary32 value. If two binary32 values are equally close, the one whose least significant bit is zero will be used. Note that finite (but large) values can be converted to infinity, and small non-zero values can be converted to zero.
Throws RangeError
if byteOffset
is negative, or byteOffset + 4
is greater than the length of this object.
Sets the eight bytes starting at the specified byteOffset
in this object to the IEEE 754 double-precision binary floating-point (binary64) representation of the specified value
.
Throws RangeError
if byteOffset
is negative, or byteOffset + 8
is greater than the length of this object.
Sets the two bytes starting at the specified byteOffset
in this object to the two's complement binary representation of the specified value
, which must fit in two bytes. In other words, value
must lie between 2<sup>15</sup> and 2<sup>15</sup> - 1, inclusive.
Throws RangeError
if byteOffset
is negative, or byteOffset + 2
is greater than the length of this object.
Sets the four bytes starting at the specified byteOffset
in this object to the two's complement binary representation of the specified value
, which must fit in four bytes. In other words, value
must lie between 2<sup>31</sup> and 2<sup>31</sup> - 1, inclusive.
Throws RangeError
if byteOffset
is negative, or byteOffset + 4
is greater than the length of this object.
Sets the eight bytes starting at the specified byteOffset
in this object to the two's complement binary representation of the specified value
, which must fit in eight bytes. In other words, value
must lie between 2<sup>63</sup> and 2<sup>63</sup> - 1, inclusive.
Throws RangeError
if byteOffset
is negative, or byteOffset + 8
is greater than the length of this object.
Sets the byte at the specified byteOffset
in this object to the two's complement binary representation of the specified value
, which must fit in a single byte. In other words, value
must be between -128 and 127, inclusive.
Throws RangeError
if byteOffset
is negative, or greater than or equal to the length of this object.
Sets the two bytes starting at the specified byteOffset
in this object to the unsigned binary representation of the specified value
, which must fit in two bytes. in other words, value
must be between 0 and 2<sup>16</sup> - 1, inclusive.
Throws RangeError
if byteOffset
is negative, or byteOffset + 2
is greater than the length of this object.
Sets the four bytes starting at the specified byteOffset
in this object to the unsigned binary representation of the specified value
, which must fit in four bytes. in other words, value
must be between 0 and 2<sup>32</sup> - 1, inclusive.
Throws RangeError
if byteOffset
is negative, or byteOffset + 4
is greater than the length of this object.
Sets the eight bytes starting at the specified byteOffset
in this object to the unsigned binary representation of the specified value
, which must fit in eight bytes. in other words, value
must be between 0 and 2<sup>64</sup> - 1, inclusive.
Throws RangeError
if byteOffset
is negative, or byteOffset + 8
is greater than the length of this object.
Sets the byte at the specified byteOffset
in this object to the unsigned binary representation of the specified value
, which must fit in a single byte. in other words, value
must be between 0 and 255, inclusive.
Throws RangeError
if byteOffset
is negative, or greater than or equal to the length of this object.
Describes endianness to be used when accessing or updating a sequence of bytes.
A fixed-length list of IEEE 754 single-precision binary floating-point numbers that is viewable as a TypedData
. For long lists, this implementation can be considerably more space- and time-efficient than the default List
implementation.
Creates a Float32List
of the specified length (in elements), all of whose elements are initially zero.
Creates a Float32List
with the same size as the elements
list and copies over the elements.
Creates a Float32List
_view_ of the specified region in the specified byte buffer. Changes in the Float32List
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.
Throws ArgumentError
if offsetInBytes
is not a multiple of BYTES_PER_ELEMENT.
Interface of Dart Float32x4 immutable value type and operations. Float32x4 stores 4 32-bit floating point values in "lanes". The lanes are "x", "y", "z", and "w" respectively.
Mask passed to shuffle
.
Extract the sign bits from each lane return them in the first 4 bits.
Extracted w value.
Extracted x value.
Extracted y value.
Extracted z value.
Multiplication operator.
Addition operator.
Subtraction operator.
Division operator.
Returns the absolute value of this Float32x4
.
Clamps this
to be in the range lowerLimit
-upperLimit
.
Relational equal.
Relational greater than.
Relational greater than or equal.
Returns a new Float32x4
with the X and Y lane values from this
and other
interleaved.
Returns a new Float32x4
with the X and Y lane value pairs from this
and other
interleaved.
Returns a new Float32x4
with the Z and W lane values from this
and other
interleaved.
Returns a new Float32x4
with the Z and W lane value pairs from this
and other
interleaved.
Relational less than.
Relational less than or equal.
Returns the lane-wise maximum value in this
or other
.
Returns the lane-wise minimum value in this
or other
.
Relational not-equal.
Returns the reciprocal of this
.
Returns the square root of the reciprocal of this
.
Returns a copy of this
each lane being scaled by s
.
Shuffle the lane values. mask
must be one of the 256 shuffle constants.
Returns the square root of this
.
Returns a bit-wise copy of this
as a Uint32x4
.
Negate operator.
Returns a new Float32x4
copied from this
with a new w value.
Returns a new Float32x4
copied from this
with a new x value.
Returns a new Float32x4
copied from this
with a new y value.
Returns a new Float32x4
copied from this
with a new z value.
Returns a new Float32x4
with values in the X and Y lanes replaced with the values in the Z and W lanes of other
.
A fixed-length list of Float32x4 numbers that is viewable as a TypedData
. For long lists, this implementation will be considerably more space- and time-efficient than the default List
implementation.
Creates a Float32x4List
of the specified length (in elements), all of whose elements are initially zero.
Creates a Float32x4List
with the same size as the elements
list and copies over the elements.
Creates a Float32x4List
_view_ of the specified region in the specified byte buffer. Changes in the Float32x4List
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.
Throws ArgumentError
if offsetInBytes
is not a multiple of BYTES_PER_ELEMENT.
A fixed-length list of IEEE 754 double-precision binary floating-point numbers that is viewable as a TypedData
. For long lists, this implementation can be considerably more space- and time-efficient than the default List
implementation.
Creates a Float64List
of the specified length (in elements), all of whose elements are initially zero.
Creates a Float64List
with the same size as the elements
list and copies over the elements.
Creates a Float64List
_view_ of the specified region in the specified byte buffer. Changes in the Float64List
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.
Throws ArgumentError
if offsetInBytes
is not a multiple of BYTES_PER_ELEMENT.
A fixed-length list of 16-bit signed integers that is viewable as a TypedData
. For long lists, this implementation can be considerably more space- and time-efficient than the default List
implementation.
Creates an Int16List
of the specified length (in elements), all of whose elements are initially zero.
Creates a Int16List
with the same size as the elements
list and copies over the elements.
Creates an Int16List
_view_ of the specified region in the specified byte buffer. Changes in the Int16List
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.
Throws ArgumentError
if offsetInBytes
is not a multiple of BYTES_PER_ELEMENT.
A fixed-length list of 32-bit signed integers that is viewable as a TypedData
. For long lists, this implementation can be considerably more space- and time-efficient than the default List
implementation.
Creates an Int32List
of the specified length (in elements), all of whose elements are initially zero.
Creates a Int32List
with the same size as the elements
list and copies over the elements.
Creates an Int32List
_view_ of the specified region in the specified byte buffer. Changes in the Int32List
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.
Throws ArgumentError
if offsetInBytes
is not a multiple of BYTES_PER_ELEMENT.
A fixed-length list of 64-bit signed integers that is viewable as a TypedData
. For long lists, this implementation can be considerably more space- and time-efficient than the default List
implementation.
Creates an Int64List
of the specified length (in elements), all of whose elements are initially zero.
Creates a Int64List
with the same size as the elements
list and copies over the elements.
Creates an Int64List
_view_ of the specified region in the specified byte buffer. Changes in the Int64List
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.
Throws ArgumentError
if offsetInBytes
is not a multiple of BYTES_PER_ELEMENT.
A fixed-length list of 8-bit signed integers. For long lists, this implementation can be considerably more space- and time-efficient than the default List
implementation.
Creates an Int8List
of the specified length (in elements), all of whose elements are initially zero.
Creates a Int8List
with the same size as the elements
list and copies over the elements.
Creates an Int8List
_view_ of the specified region in the specified byte buffer. Changes in the Int8List
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.
A typed view of a sequence of bytes.
Returns the byte buffer associated with this object.
Returns the number of bytes in the representation of each element in this list.
Returns the length of this view, in bytes.
Returns the offset in bytes into the underlying byte buffer of this view.
A fixed-length list of 16-bit unsigned integers that is viewable as a TypedData
. For long lists, this implementation can be considerably more space- and time-efficient than the default List
implementation.
Creates a Uint16List
of the specified length (in elements), all of whose elements are initially zero.
Creates a Uint16List
with the same size as the elements
list and copies over the elements.
Creates a Uint16List
_view_ of the specified region in the specified byte buffer. Changes in the Uint16List
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.
Throws ArgumentError
if offsetInBytes
is not a multiple of BYTES_PER_ELEMENT.
A fixed-length list of 32-bit unsigned integers that is viewable as a TypedData
. For long lists, this implementation can be considerably more space- and time-efficient than the default List
implementation.
Creates a Uint32List
of the specified length (in elements), all of whose elements are initially zero.
Creates a Uint32List
with the same size as the elements
list and copies over the elements.
Creates a Uint32List
_view_ of the specified region in the specified byte buffer. Changes in the Uint32
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.
Throws ArgumentError
if offsetInBytes
is not a multiple of BYTES_PER_ELEMENT.
Interface of Dart Uint32x4 and operations. Uint32x4 stores 4 32-bit bit-masks in "lanes". The lanes are "x", "y", "z", and "w" respectively.
Extracted w value. Returns false for 0, true for any other value.
Extracted x value. Returns false for 0, true for any other value.
Extracted y value. Returns false for 0, true for any other value.
Extracted z value. Returns false for 0, true for any other value.
Extract the top bit from each lane return them in the first 4 bits.
Extract 32-bit mask from w lane.
Extract 32-bit mask from x lane.
Extract 32-bit mask from y lane.
Extract 32-bit mask from z lane.
The bit-wise and operator.
Addition operator.
Subtraction operator.
The bit-wise xor operator.
Merge trueValue
and falseValue
based on this
' bit mask: Select bit from trueValue
when bit in this
is on. Select bit from falseValue
when bit in this
is off.
Returns a bit-wise copy of this
as a Float32x4
.
Returns a new Uint32x4
copied from this
with a new w value.
Returns a new Uint32x4
copied from this
with a new x value.
Returns a new Uint32x4
copied from this
with a new y value.
Returns a new Uint32x4
copied from this
with a new z value.
Returns a new Uint32x4
copied from this
with a new w value.
Returns a new Uint32x4
copied from this
with a new x value.
Returns a new Uint32x4
copied from this
with a new y value.
Returns a new Uint32x4
copied from this
with a new z value.
The bit-wise or operator.
A fixed-length list of 64-bit unsigned integers that is viewable as a TypedData
. For long lists, this implementation can be considerably more space- and time-efficient than the default List
implementation.
Creates a Uint64List
of the specified length (in elements), all of whose elements are initially zero.
Creates a Uint64List
with the same size as the elements
list and copies over the elements.
Creates an Uint64List
_view_ of the specified region in the specified byte buffer. Changes in the Uint64List
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.
Throws ArgumentError
if offsetInBytes
is not a multiple of BYTES_PER_ELEMENT.
A fixed-length list of 8-bit unsigned integers. For long lists, this implementation can be considerably more space- and time-efficient than the default List
implementation. Indexed store clamps the value to range 0..0xFF.
Creates a Uint8ClampedList
of the specified length (in elements), all of whose elements are initially zero.
Creates a Uint8ClampedList
of the same size as the elements
list and copies over the values clamping when needed.
Creates a Uint8ClampedList
_view_ of the specified region in the specified byte buffer
. Changes in the Uint8List
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.
A fixed-length list of 8-bit unsigned integers. For long lists, this implementation can be considerably more space- and time-efficient than the default List
implementation.
Creates a Uint8List
of the specified length (in elements), all of whose elements are initially zero.
Creates a Uint8List
with the same size as the elements
list and copies over the elements.
Creates a Uint8List
_view_ of the specified region in the specified byte buffer. Changes in the Uint8List
will be visible in the byte buffer and vice versa. If the offsetInBytes
index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.
Throws RangeError
if offsetInBytes
or length
are negative, or if offsetInBytes
+ (length
* elementSizeInBytes) is greater than the length of buffer
.