Skip to content

feat: BufferedReadStream process multiple bytes at once in ReadLineAsync#82

Merged
HofmeisterAn merged 6 commits intotestcontainers:mainfrom
campersau:bufferedreadstreamreadline
Mar 6, 2026
Merged

feat: BufferedReadStream process multiple bytes at once in ReadLineAsync#82
HofmeisterAn merged 6 commits intotestcontainers:mainfrom
campersau:bufferedreadstreamreadline

Conversation

@campersau
Copy link

First commit changes ReadLineAsync to use a MemoryStream instead of StringBuilder and no longer reads individual bytes.
Also fixes bug when the returned _bufferCount was 0.
Second commit passes a MemoryStream from outside so the same instance can be used for multiple reads.

Would be nice to write tests for this, but it is internal.

Fixes #57

@campersau campersau force-pushed the bufferedreadstreamreadline branch from b5d78e4 to 95cd0b1 Compare March 4, 2026 19:58
@campersau
Copy link
Author

Moved the MemoryStream to BufferedReadStream so it can be reused for everything: reading headers / reading chunked lines.

@HofmeisterAn HofmeisterAn changed the title BufferedReadStream process multiple bytes at once in ReadLineAsync feat: BufferedReadStream process multiple bytes at once in ReadLineAsync Mar 5, 2026
@HofmeisterAn HofmeisterAn added the enhancement New feature or request label Mar 5, 2026
Copy link
Collaborator

@HofmeisterAn HofmeisterAn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@HofmeisterAn HofmeisterAn merged commit dd3ec3c into testcontainers:main Mar 6, 2026
15 checks passed
@campersau campersau deleted the bufferedreadstreamreadline branch March 6, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use PipeReader for more efficient line reading in BufferedReadStream

2 participants