# BufferedInputStream class

A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the input and to support the mark and reset methods.

When the BufferedInputStream is created, an internal buffer array is created. As bytes from the stream are read or skipped, the internal buffer is refilled as necessary from the contained input stream, many bytes at a time.

## Example Usage

    // Basic buffered reading
    final buffered = BufferedInputStream(FileInputStream('large_file.bin'));
    try {
      final buffer = Uint8List(1024);
      int bytesRead;
      while ((bytesRead = await buffered.read(buffer)) != -1) {
        processData(buffer.sublist(0, bytesRead));
      }
    } finally {
      await buffered.close();
    }

    // Using mark and reset
    final buffered = BufferedInputStream(FileInputStream('data.bin'));
    try {
      buffered.mark(1024); // Mark current position

      final header = await buffered.readFully(10);
      if (!isValidHeader(header)) {
        await buffered.reset(); // Go back to marked position
        processAsRawData(buffered);
      } else {
        processStructuredData(buffered);
      }
    } finally {
      await buffered.close();
    }

Inheritance
  - Object
  - InputStream
  - BufferedInputStream

## Constructors

BufferedInputStream.new(InputStream input, {int bufferSize = _defaultBufferSize})
  Creates a BufferedInputStream and saves its argument, the input stream `input`, for later use.

## Properties

bufferedCount → int
  Returns the number of bytes currently available in the buffer.
  no setter
bufferSize → int
  Returns the size of the internal buffer.
  no setter
hashCode → int
  The hash code for this object.
  no setter inherited
isClosed → bool
  Returns `true` if this stream has been closed.
  no setter inherited
runtimeType → Type
  A representation of the runtime type of the object.
  no setter inherited
underlyingStream → InputStream
  Returns the underlying input stream.
  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.
  override
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