ByteSource class abstract interface

Random-access byte source, the input abstraction every archive reader consumes. Never a file path, never a raw stream.

Contract

  • pread semantics: implementations MUST support concurrent positional reads: overlapping in-flight read calls must not interfere with each other. There is no shared cursor.
  • read returns exactly length bytes. A range that extends past length throws UnexpectedEofException (typed, so corrupt headers pointing past EOF surface as archive errors, never RangeError). Negative offset or length is a programmer error (ArgumentError).
  • The returned buffer MAY be a view over shared memory; callers must not mutate it, and implementations must not reuse it for later reads.
  • After close, read throws ArchiveClosedException. close is idempotent.
  • Nothing may assume the source is local or cheap to read: an HTTP-range implementation must be possible without core changes. Callers should read in as few, as large, requests as practical.

Properties

hashCode → int
The hash code for this object.
no setterinherited
length → int
Total length of the source in bytes.
no setter
name → String?
Optional display name for the source (a file path, a browser File name), used by formats that derive entry names from the container (e.g. a bare .gz with no FNAME field). Null when the source has no meaningful name.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → Future<void>
Releases any resources held by the source. Idempotent.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(int offset, int length) → Future<Uint8List>
Reads exactly length bytes starting at byte offset.
toString() → String
A string representation of this object.
inherited

Operators

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