# mark method

1. @override

void mark(

1. int readLimit

)
override

Marks the current position in this input stream.

A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.

The `readLimit` argument tells this input stream to allow that many bytes to be read before the mark position gets invalidated.

## Parameters

- `readLimit`: The maximum limit of bytes that can be read before the mark position becomes invalid

## Example

    final input = BufferedInputStream(FileInputStream('data.txt'));
    if (input.markSupported()) {
      input.mark(1024); // Allow up to 1024 bytes to be read

      // Peek at the data
      final header = await input.readFully(10);

      if (isValidHeader(header)) {
        // Reset and process the entire stream
        await input.reset();
        processStream(input);
      }
    }

Throws IOException if the stream does not support mark, or if some other I/O error occurs.

## Implementation

    @override
    void mark(int readLimit) {
      if (isClosed) {
        return;
      }

      _markLimit = readLimit;
      _markPosition = _position;
    }