1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibCore: Rename Stream::read_all to read_until_eof

This generally seems like a better name, especially if we somehow also
need a better name for "read the entire buffer, but not the entire file"
somewhere down the line.
This commit is contained in:
Tim Schumacher 2022-12-11 17:49:00 +01:00 committed by Andreas Kling
parent 5061a905ff
commit ed4c2f2f8e
65 changed files with 88 additions and 88 deletions

View file

@ -39,7 +39,7 @@ public:
/// Reads the stream until EOF, storing the contents into a ByteBuffer which
/// is returned once EOF is encountered. The block size determines the size
/// of newly allocated chunks while reading.
virtual ErrorOr<ByteBuffer> read_all(size_t block_size = 4096);
virtual ErrorOr<ByteBuffer> read_until_eof(size_t block_size = 4096);
/// Discards the given number of bytes from the stream.
/// Unless specifically overwritten, this just uses read() to read into an
/// internal stack-based buffer.
@ -69,12 +69,12 @@ public:
}
protected:
/// Provides a default implementation of read_all that works for streams
/// Provides a default implementation of read_until_eof that works for streams
/// that behave like POSIX file descriptors. expected_file_size can be
/// passed as a heuristic for what the Stream subclass expects the file
/// content size to be in order to reduce allocations (does not affect
/// actual reading).
ErrorOr<ByteBuffer> read_all_impl(size_t block_size, size_t expected_file_size = 0);
ErrorOr<ByteBuffer> read_until_eof_impl(size_t block_size, size_t expected_file_size = 0);
};
enum class SeekMode {
@ -238,7 +238,7 @@ public:
}
virtual ErrorOr<Bytes> read(Bytes) override;
virtual ErrorOr<ByteBuffer> read_all(size_t block_size = 4096) override;
virtual ErrorOr<ByteBuffer> read_until_eof(size_t block_size = 4096) override;
virtual ErrorOr<size_t> write(ReadonlyBytes) override;
virtual bool is_eof() const override;
virtual bool is_open() const override;