[io/doc] Document when read/readSync can return return less than requested bytes

Bug:https://github.com/dart-lang/sdk/issues/50034
Change-Id: Ib2f2b11bc3ae1fe241b71a43f2866233e066d8e2
CoreLibraryReviewExempt: Documentation-only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328802
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
This commit is contained in:
Brian Quinlan 2023-09-29 21:21:38 +00:00 committed by Commit Queue
parent 850bfe016e
commit 3fae23ae69

View file

@ -631,10 +631,24 @@ abstract interface class RandomAccessFile {
int readByteSync();
/// Reads up to [count] bytes from a file.
///
/// May return fewer than [count] bytes. This can happen, for example, when
/// reading past the end of a file or when reading from a pipe that does not
/// currently contain additional data.
///
/// An empty [Uint8List] will only be returned when reading past the end of
/// the file or when [count] is `0`.
Future<Uint8List> read(int count);
/// Synchronously reads up to [count] bytes from a file
///
/// May return fewer than [count] bytes. This can happen, for example, when
/// reading past the end of a file or when reading from a pipe that does not
/// currently contain additional data.
///
/// An empty [Uint8List] will only be returned when reading past the end of
/// the file or when [count] is `0`.
///
/// Throws a [FileSystemException] if the operation fails.
Uint8List readSync(int count);