In this case:
auto array = Array<u8, 128> {};
// First line: 8 bytes, second line: 24 bytes, third line, 32 bytes
array.fill('A');
array[7] = '\n';
array[31] = '\n';
array[63] = '\n';
auto memory_stream = make<FixedMemoryStream>(array.span(), FixedMemoryStream::Mode::ReadOnly);
// Buffer for buffered seekable is larger than the stream, so stream goes EOF immediately on read
auto buffered_stream = TRY_OR_FAIL(InputBufferedSeekable<FixedMemoryStream>::create(move(memory_stream), 32));
// Buffer is only 16 bytes, first read succeeds, second fails
auto buffer = TRY_OR_FAIL(ByteBuffer::create_zeroed(16));
auto read_bytes = TRY_OR_FAIL(buffered_stream->read_line(buffer));
auto read_or_error = buffered_stream->read_line(buffer);
// Oops! only read 16 bytes!
We fail to error out the read_line in the case that the user's buffer is too small for the line.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too