sniffReaderSync function

AudioProbe sniffReaderSync(
  1. ReadAtSync readAt, {
  2. required int? length,
})

Like sniffBytes, but reads through readAt so only the bytes each parser needs are touched. length is the total size, or null when it is unknown.

Implementation

AudioProbe sniffReaderSync(ReadAtSync readAt, {required int? length}) {
  return probeWith(
    ByteReader((offset, count) {
      try {
        return asBytes(readAt(offset, count));
      } on Object {
        return Uint8List(0);
      }
    }, length),
  );
}