openRead method
Creates a new independent Stream for the contents of this file starting
from start
and ending at end
.
Throws InvalidFileException if the AWSFile is initiated using AWSFile.fromStream.
Implementation
@override
Stream<List<int>> openRead([int? start, int? end]) {
final file = _inputFile;
if (file != null) {
return File(file.path).openRead(start, end);
}
final bytes = super.bytes;
if (bytes != null) {
return Stream.value(
bytes.sublist(start ?? 0, end),
);
}
throw const InvalidFileException(
recoverySuggestion:
'Cannot use `openRead` with an AWSFile that is initiated with a stream.',
);
}