ByteBufferDataInputStream class

A wrapper around an int List, for synchronous reading of typed binary data from a byte array. This is similar to a java.io.DataInputStream over a java.io.ByteArrayInputStream.

See also DataInputStream

Constructors

ByteBufferDataInputStream(List<int> source, [Endian endian = Endian.big])
Create a stream that takes its data from source with the given initial endian setting. Choose Endian.big for interoperability with java.io.DataInputStream.
ByteBufferDataInputStream.copy(ByteBufferDataInputStream other)
Create a copy of ths input stream with the same underlying data as other at the same position.

Properties

bytesAvailable → int
Returns the number of bytes that can be read from the internal buffer. If we're at EOF, returns zero, otherwise, returns a non-zero positive integer.
no setter
endian ↔ Endian
The current endian setting, either Endian.big or Endian.little. This is used for converting numeric types. Choose Endian.big for interoperability with java.io.DataInputStream.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
seek ↔ int
The seek position within the buffer, in bytes from the start
getter/setter pair

Methods

close() → void
Render this stream un-readalbe. This positions the stream to EOF.
isEOF() → bool
Check if we're at end of file.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read() → int
Returns the next unsigned byte, or -1 on EOF
readBoolean() → bool
Reads a byte, and returns false if it is 0, true otherwise.
readByte() → int
Reads a signed byte. Returns an int between -128 and 127, inclusive. See also readUnsignedByte.
readBytes(int num) → Uint8List
Returns a new, mutable Uint8List containing the desired number of bytes.
readBytesImmutable(int num) → Uint8List
Returns a potentially immutable Uint8List containing the desired number of bytes. If the returned list is mutable, changing it might write through our internal buffer.
readDouble() → double
Reads and returns an 8-byte double, using the current endian setting.
readFloat() → double
Reads and returns a 4-byte float, using the current endian setting.
readInt() → int
Reads and returns a 4-byte signed integer decoded with the current endian setting.
readLong() → int
Reads and returns an 8-byte signed integer decoded with the current endian setting.
readShort() → int
Reads and returns a 2-byte signed integer decoded with the current endian setting.
readUnsignedByte() → int
Reads and returns an unsigned byte.
readUnsignedInt() → int
Reads and returns a 4-byte unsigned integer decoded with the current endian setting.
readUnsignedLong() → int
Reads and returns an 8-byte unsigned integer, converted to a Dart int according to the semantics of ByteData.getUint64 using the current endian setting.
readUnsignedShort() → int
Reads and returns a 2-byte unsigned integer decoded with the current endian setting.
readUTF8() → String
Reads a string encoded in UTF8. This method first reads a 2 byte unsigned integer decoded with the current endian setting, giving the number of UTF8 bytes to read. It then reads those bytes, and converts them to a string using Dart's UTF8 conversion. This may be incompatible with java.io.DataOutputStream for a string that contains nulls.
remaining() → Uint8List
Give the remaining data in a list that is a view on the underlying buffer
remainingCopy() → Uint8List
Returns a new, mutable Uint8List containing the remaining data
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited