Buffer class
Buffer
Methods
any (bool test (int element ) )
→ bool
Checks whether any element of this iterable satisfies test.
inherited
asByteData ([int offset = 0 , int ? length ])
→ ByteData
Creates a ByteData view over a region of the buffer.
asUint8List ()
→ Uint8List
Creates a Uint8List view over the buffer.
cast <R > ()
→ Iterable <R >
A view of this iterable as an iterable of R instances.
inherited
contains (Object ? element )
→ bool
Whether the collection contains an element equal to element.
inherited
copy (Buffer dst , [int dstOffset = 0 , int offset = 0 , int ? length ])
→ void
Copies items from this buffer to the destination (dst) buffer.
Items are copied to dst starting at position dstOffset.
Items are copied from the range [offset : offset+length]. If length is omitted, the range extends to the end of this or [dst] (whichever has the minimum length).
The range must satisfy the relations 0 ≤ offset ≤ offset+length ≤ this.length.
elementAt (int index )
→ int
Returns the indexth element.
inherited
every (bool test (int element ) )
→ bool
Checks whether every element of this iterable satisfies test.
inherited
expand <T > (Iterable <T > toElements (int element ) )
→ Iterable <T >
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere (bool test (int element ), {int orElse ()? })
→ int
The first element that satisfies the given predicate test.
inherited
fold <T > (T initialValue , T combine (T previousValue , int element ) )
→ T
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
followedBy (Iterable <int > other )
→ Iterable <int >
Creates the lazy concatenation of this iterable and other.
inherited
forEach (void action (int element ) )
→ void
Invokes action on each element of this iterable in iteration order.
inherited
getAll (int offset )
→ Iterable <int >
Reads the buffer starting at offset into a byte array.
The offset must satisfy the relations 0 ≤ offset ≤ this.length.
getBigInt (int offset , int length , [Endian endian = Endian.little ])
→ BigInt
Reads a region of the buffer as a signed big integer.
Items are read from the range [offset : offset+length].
The range must satisfy the relations 0 ≤ offset ≤ offset+length ≤ this.length.
getBigUint (int offset , int length , [Endian endian = Endian.little ])
→ BigInt
Reads a region of the buffer as an unsigned big integer.
Items are read from the range [offset : offset+length].
The range must satisfy the relations 0 ≤ offset ≤ offset+length ≤ this.length.
getBool (int offset )
→ bool
Reads 1-byte as a boolean.
The offset must satisfy the relations 0 ≤ offset ≤ offset+1 ≤ this.length.
getDateTime (int offset , [Endian endian = Endian.little ])
→ DateTime
Reads an i64 from the buffer as an epoch timestamp.
The offset must satisfy the relations 0 ≤ offset ≤ offset+8 ≤ this.length.
getFloat32 (int offset , [Endian endian = Endian.little ])
→ double
Reads 4-bytes as a floating point value.
The offset must satisfy the relations 0 ≤ offset ≤ offset+4 ≤ this.length.
getFloat64 (int offset , [Endian endian = Endian.little ])
→ double
Reads 8-bytes as a double precision floating point value.
The offset must satisfy the relations 0 ≤ offset ≤ offset+8 ≤ this.length.
getInt (int offset , int length , [Endian endian = Endian.little ])
→ int
Reads a region of the buffer as a signed integer.
Items are read from the range [offset : offset+length].
The range must satisfy the relations 0 ≤ offset ≤ offset+length ≤ this.length.
getInt128 (int offset , [Endian endian = Endian.little ])
→ BigInt
Reads 16-bytes as a signed integer.
The offset must satisfy the relations 0 ≤ offset ≤ offset+8 ≤ this.length.
getInt16 (int offset , [Endian endian = Endian.little ])
→ int
Reads 2-bytes as a signed integer.
The offset must satisfy the relations 0 ≤ offset ≤ offset+2 ≤ this.length.
getInt32 (int offset , [Endian endian = Endian.little ])
→ int
Reads 4-bytes as a signed integer.
The offset must satisfy the relations 0 ≤ offset ≤ offset+4 ≤ this.length.
getInt64 (int offset , [Endian endian = Endian.little ])
→ int
Reads 8-bytes as a signed integer.
The offset must satisfy the relations 0 ≤ offset ≤ offset+8 ≤ this.length.
getInt8 (int offset )
→ int
Reads 1-byte as a signed integer.
The offset must satisfy the relations 0 ≤ offset ≤ offset+1 ≤ this.length.(value);
getString (BufferEncoding encoding , [int offset = 0 , int ? length ])
→ String
Reads a region of the buffer as an encoded string.
getUint (int offset , int length , [Endian endian = Endian.little ])
→ int
Reads a region of the buffer as an unsigned integer.
Items are read from the range [offset : offset+length].
The range must satisfy the relations 0 ≤ offset ≤ offset+length ≤ this.length.
getUint128 (int offset , [Endian endian = Endian.little ])
→ BigInt
Reads 16-bytes as an unsigned integer.
The offset must satisfy the relations 0 ≤ offset ≤ offset+8 ≤ this.length.
getUint16 (int offset , [Endian endian = Endian.little ])
→ int
Reads 2-bytes as an unsigned integer.
The offset must satisfy the relations 0 ≤ offset ≤ offset+2 ≤ this.length.
getUint32 (int offset , [Endian endian = Endian.little ])
→ int
Reads 4-bytes as an unsigned integer.
The offset must satisfy the relations 0 ≤ offset ≤ offset+4 ≤ this.length.
getUint64 (int offset , [Endian endian = Endian.little ])
→ BigInt
Reads 8-bytes as an unsigned integer.
The offset must satisfy the relations 0 ≤ offset ≤ offset+8 ≤ this.length.
getUint8 (int offset )
→ int
Reads 1-byte as an unsigned integer.
The offset must satisfy the relations 0 ≤ offset ≤ offset+1 ≤ this.length.
join ([String separator = "" ])
→ String
Converts each element to a String and concatenates the strings.
inherited
lastWhere (bool test (int element ), {int orElse ()? })
→ int
The last element that satisfies the given predicate test.
inherited
map <T > (T toElement (int e ) )
→ Iterable <T >
The current elements of this iterable modified by toElement.
inherited
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reduce (int combine (int value , int element ) )
→ int
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
setAll (int offset , Iterable <int > bytes )
→ void
Writes a byte array to a region of the buffer starting at offset.
setBigInt (BigInt value , int offset , [int ? length , Endian endian = Endian.little ])
→ int
Writes a big signed integer to a region of the buffer.
setBigUint (BigInt value , int offset , [int ? length , Endian endian = Endian.little ])
→ int
Writes a big unsigned integer to a region of the buffer.
setBool (bool value , int offset )
→ int
Writes a boolean value to 1-byte.
The offset must satisfy the relations 0 ≤ offset ≤ offset+1 ≤ this.length.
setDateTime (DateTime value , int offset , [Endian endian = Endian.little ])
→ void
Writes a DateTime to the buffer as an i64.
The offset must satisfy the relations 0 ≤ offset ≤ offset+8 ≤ this.length.
setFloat32 (double value , int offset , [Endian endian = Endian.little ])
→ void
Writes a floating point value to 4-bytes.
The offset must satisfy the relations 0 ≤ offset ≤ offset+4 ≤ this.length.
setFloat64 (double value , int offset , [Endian endian = Endian.little ])
→ void
Writes a double precision floating point value to 8-bytes.
The offset must satisfy the relations 0 ≤ offset ≤ offset+8 ≤ this.length.
setInt (int value , int offset , int length , [Endian endian = Endian.little ])
→ int
Writes a signed integer to a region of the buffer.
The value is written to the range [offset : offset+length].
The range must satisfy the relations 0 ≤ offset ≤ offset+length ≤ this.length.
Returns the position of the last element written to the buffer ([offset]+[length]).
setInt128 (BigInt value , int offset , [Endian endian = Endian.little ])
→ void
Writes a signed integer to 16-bytes.
The offset must satisfy the relations 0 ≤ offset ≤ offset+8 ≤ this.length.
setInt16 (int value , int offset , [Endian endian = Endian.little ])
→ void
Writes a signed integer to 2-bytes.
The offset must satisfy the relations 0 ≤ offset ≤ offset+2 ≤ this.length.
setInt32 (int value , int offset , [Endian endian = Endian.little ])
→ void
Writes a signed integer to 4-bytes.
The offset must satisfy the relations 0 ≤ offset ≤ offset+4 ≤ this.length.
setInt64 (int value , int offset , [Endian endian = Endian.little ])
→ void
Writes a signed integer to 8-bytes.
The offset must satisfy the relations 0 ≤ offset ≤ offset+8 ≤ this.length.
setInt8 (int value , int offset )
→ void
Writes a signed integer to 1-byte.
The offset must satisfy the relations 0 ≤ offset ≤ offset+1 ≤ this.length.
setString (String value , BufferEncoding encoding , [int offset = 0 , int ? length ])
→ int
Writes an `encoded value to a region of the buffer.
setUint (int value , int offset , int length , [Endian endian = Endian.little ])
→ int
Writes an unsigned integer to a region of the buffer.
setUint128 (BigInt value , int offset , [Endian endian = Endian.little ])
→ void
Writes an unsigned integer to 16-bytes.
The offset must satisfy the relations 0 ≤ offset ≤ offset+8 ≤ this.length.
setUint16 (int value , int offset , [Endian endian = Endian.little ])
→ void
Writes an unsigned integer to 2-bytes.
The offset must satisfy the relations 0 ≤ offset ≤ offset+2 ≤ this.length.
setUint32 (int value , int offset , [Endian endian = Endian.little ])
→ void
Writes an unsigned integer to 4-bytes.
The offset must satisfy the relations 0 ≤ offset ≤ offset+4 ≤ this.length.
setUint64 (BigInt value , int offset , [Endian endian = Endian.little ])
→ void
Writes an unsigned integer to 8-bytes.
The offset must satisfy the relations 0 ≤ offset ≤ offset+8 ≤ this.length.
setUint8 (int value , int offset )
→ void
Writes an unsigned integer to 1-byte.
If value falls outside the range 0 : 255 (inclusive), the integer is overflow (e.g.
-2 -> [254], -1 -> [255], ..., 256 -> [0] and 257 -> [1]).
The offset must satisfy the relations 0 ≤ offset ≤ offset+1 ≤ this.length.
singleWhere (bool test (int element ), {int orElse ()? })
→ int
The single element that satisfies test.
inherited
skip (int count )
→ Iterable <int >
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile (bool test (int value ) )
→ Iterable <int >
Creates an Iterable that skips leading elements while test is satisfied.
inherited
slice ([int offset = 0 , int ? length ])
→ Buffer
Creates a new Buffer from a region of this buffer.
Items are copied from the range [offset : offset+length]. If length is omitted, the range extends to the end of the buffer.
The range must satisfy the relations 0 ≤ offset ≤ offset+length ≤ this.length.
take (int count )
→ Iterable <int >
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile (bool test (int value ) )
→ Iterable <int >
Creates a lazy iterable of the leading elements satisfying test.
inherited
toList ({bool growable = true })
→ List <int >
Creates a List containing the elements of this Iterable .
inherited
toSet ()
→ Set <int >
Creates a Set containing the same elements as this iterable.
inherited
toString ()
→ String
Returns a string representation of (some of) the elements of this.
inherited
where (bool test (int element ) )
→ Iterable <int >
Creates a new lazy Iterable with all elements that satisfy the
predicate test.
inherited
whereType <T > ()
→ Iterable <T >
Creates a new lazy Iterable with all elements that have type T.
inherited