BytesIO class abstract
Bytes input and output interface.
- Implementers
Constructors
- BytesIO()
Properties
- bytesData → IntCodec
-
The internal ByteData to write integers and doubles.
no setter
- capacity → int
-
Returns the size of the internal bytes buffer (Uint8List).
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Returns
trueif this IO was closed.no setter - isEmpty → bool
-
Returns
trueifthisinstance is empty.no setter - isNotEmpty → bool
-
Returns
trueifthisinstance is NOT empty.no setter - length → int
-
The length of bytes in this buffer.
no setter
- position → int
-
The current read/write cursor position in the bytes buffer.
no setter
- remaining → int
-
The remaining bytes to read from position to the end of the buffer.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- supportsClosing → bool
-
Returns
trueif this implementation supports the close operation.no setter
Methods
-
asUint8List(
[int offset = 0, int? length]) → Uint8List -
Returns
thisinstance as a Uint8List. Returns the internalbytesbuffer if thelengthand capacity is the same, otherwise creates a copy with the exactlength. -
bytesTo<
R> (R output(Uint8List bytes, int offset, int length), [int offset = 0, int? length]) → R -
Calls the function
outputwith the internal bytes of this instance. -
canRead(
int length) → bool -
Returns
trueif at the current position it's possible to readlengthbytes. -
checkCanRead(
int length) → void -
Checks if at the current position it's possible to read
lengthbytes. -
close(
) → dynamic - Closes IO.
-
compact(
) → bool - Compact the internal bytes capacity to length.
-
ensureCapacity(
int needed) → void -
Ensures that capacity can store the
neededbytes. -
flush(
) → void - Flushes data.
-
incrementPosition(
int n) → void -
Increments position in
nbytes. -
indexOf(
int byte, [int offset = 0, int? length]) → int -
Returns the index of
byteinfoffsetandlengthrange. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readByte(
) → int - Reads 1 byte. Increments position by 1.
-
readBytes(
int length) → Uint8List -
Reads an Uint8List of
length. -
readTo(
BytesIO io, [int? length]) → int -
Read
lengthbytes intoio. -
reset(
) → void -
Resets this buffer. Sets the length and position to
0. -
seek(
int position) → int -
Changes the read/write cursor
position. -
setLength(
int length) → void -
Sets the
lengthof this buffer. Increases internal bytes buffer capacity if needed. -
toBytes(
[int offset = 0, int? length]) → Uint8List -
Returns a copy of the internal bytes (Uint8List) of
thisinstance. -
toString(
) → String -
A string representation of this object.
override
-
write(
List< int> list, [int offset = 0, int? length]) → int -
Writes the
intatlistas bytes, respectingoffsetandlengthparameters. -
writeAll(
List< int> list) → int -
Writes all the
intatlistas bytes. -
writeAllBytes(
Uint8List bytes) → int -
Writes all the
bytesinto this buffer. -
writeByte(
int b) → int - Writes 1 byte. Increments position by 1.
-
writeBytes(
Uint8List bs, [int offset = 0, int? length]) → int -
Writes the
bytesinto this buffer, respectingoffsetandlengthparameters. -
writeFrom(
BytesIO io, [int? length]) → int -
Writes
lengthbytes fromio.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited