# ByteArrayInputStream class

A byte-based input stream that reads from a Uint8List buffer.

`ByteArrayInputStream` provides a non-blocking, in-memory implementation of the InputStream interface over a Dart Uint8List. It's particularly useful for:

- Testing input-based logic without relying on external files or sockets.
- Wrapping encoded or serialized in-memory data for streaming processing.
- Implementing low-latency input pipelines (e.g., compression, decryption).

Unlike traditional Streams in Dart, this class offers fine-grained control over the byte cursor, with support for methods like `mark()` and `reset()` if implemented in the extended InputStream class.

### 🔧 Example:

    final bytes = Uint8List.fromList([104, 101, 108, 108, 111]); // "hello"
    final inputStream = ByteArrayInputStream(bytes);

    final char1 = inputStream.read(); // 104 (h)
    final char2 = inputStream.read(); // 101 (e)

### ✅ Use Cases:

- Parsing binary data from a known byte array.
- Emulating I/O in memory-constrained or test environments.
- Providing a readable wrapper for encoded API payloads.

Inheritance
  - Object
  - InputStream
  - ByteArrayInputStream

## Constructors

ByteArrayInputStream.new(Uint8List _buffer)
  A byte-based input stream that reads from a Uint8List buffer.
ByteArrayInputStream.fromRange(Uint8List buffer, int offset, int length)
  A byte-based input stream that reads from a Uint8List buffer.

## Properties

hashCode → int
  The hash code for this object.
  no setter inherited
isAtEnd → bool
  Returns true if all data has been read.
  no setter
isClosed → bool
  Returns `true` if this stream has been closed.
  no setter inherited
position → int
  Returns the current position in the buffer.
  no setter
runtimeType → Type
  A representation of the runtime type of the object.
  no setter inherited
size → int
  Returns the size of the buffer.
  no setter

## Methods

available() → Future<int>
  Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.
  override
checkClosed() → void
  Checks if the stream is closed and throws an exception if it is.
  inherited
close() → Future<void>
  Closes this input stream and releases any system resources associated with the stream.
  inherited
mark(int readLimit) → void
  Marks the current position in this input stream.
  override
markSupported() → bool
  Tests if this input stream supports the mark and reset methods.
  override
noSuchMethod(Invocation invocation) → dynamic
  Invoked when a nonexistent method or property is accessed.
  inherited
read(List<int> b, [int offset = 0, int? length]) → Future<int>
  Reads some number of bytes from the input stream and stores them into the buffer array `b`.
  override
readAll() → Future<Uint8List>
  Reads all remaining bytes from the input stream.
  inherited
readByte() → Future<int>
  Reads the next byte of data from the input stream.
  override
readFully(int length) → Future<Uint8List>
  Reads exactly `length` bytes from the input stream.
  inherited
reset() → Future<void>
  Repositions this stream to the position at the time the mark method was last called on this input stream.
  override
skip(int n) → Future<int>
  Skips over and discards `n` bytes of data from this input stream.
  override
toString() → String
  A string representation of this object.
  inherited

## Operators

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