Buffer$Typings extension
- on
Properties
- capacity → num
-
Available on Buffer, provided by the Buffer$Typings extension
The read only capacity of the buffer's underlying byte slice, that is, the total space allocated for the buffer's data.no setter - length → num
-
Available on Buffer, provided by the Buffer$Typings extension
A read only number of bytes of the unread portion of the buffer.no setter
Methods
-
bytes(
[IInline8? options]) → Uint8List -
Available on Buffer, provided by the Buffer$Typings extension
Returns a slice holding the unread portion of the buffer. -
empty(
) → bool -
Available on Buffer, provided by the Buffer$Typings extension
Returns whether the unread portion of the buffer is empty. -
grow(
num n) → void -
Available on Buffer, provided by the Buffer$Typings extension
Grows the buffer's capacity, if necessary, to guarantee space for anothern
bytes. After.grow(n)
, at leastn
bytes can be written to the buffer without another allocation. Ifn
is negative,.grow()
will throw. If the buffer can't grow it will throw an error. -
read(
Uint8List p) → Future< num?> -
Available on Buffer, provided by the Buffer$Typings extension
Reads the nextp.length
bytes from the buffer or until the buffer is drained. Resolves to the number of bytes read. If the buffer has no data to return, resolves to EOF (null
). -
readFrom(
Reader r) → Future< num> -
Available on Buffer, provided by the Buffer$Typings extension
Reads data fromr
until EOF (null
) and appends it to the buffer, growing the buffer as needed. It resolves to the number of bytes read. If the buffer becomes too large,.readFrom()
will reject with an error. -
readFromSync(
ReaderSync r) → num -
Available on Buffer, provided by the Buffer$Typings extension
Reads data fromr
until EOF (null
) and appends it to the buffer, growing the buffer as needed. It returns the number of bytes read. If the buffer becomes too large,.readFromSync()
will throw an error. -
readSync(
Uint8List p) → num? -
Available on Buffer, provided by the Buffer$Typings extension
Reads the nextp.length
bytes from the buffer or until the buffer is drained. Returns the number of bytes read. If the buffer has no data to return, the return is EOF (null
). -
reset(
) → void -
Available on Buffer, provided by the Buffer$Typings extension
Resets the buffer to be empty, but it retains the underlying storage for use by future writes..reset()
is the same as.truncate(0)
. -
truncate(
num n) → void -
Available on Buffer, provided by the Buffer$Typings extension
Discards all but the firstn
unread bytes from the buffer but continues to use the same allocated storage. It throws ifn
is negative or greater than the length of the buffer. -
write(
Uint8List p) → Future< num> -
Available on Buffer, provided by the Buffer$Typings extension
NOTE: This methods writes bytes synchronously; it's provided for compatibility withWriter
interface. -
writeSync(
Uint8List p) → num -
Available on Buffer, provided by the Buffer$Typings extension
Writesp.byteLength
bytes fromp
to the underlying data stream. It returns the number of bytes written fromp
(0
<=n
<=p.byteLength
) and any error encountered that caused the write to stop early.writeSync()
must throw a non-null error if it returnsn
<p.byteLength
.writeSync()
must not modify the slice data, even temporarily.