-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ListOutputStream doesn't support streaming #4335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is made worse by issue #4202, since it's not even safe for the code creating the ListOutputStream to register an onClosed handler since it might get clobbered later. |
What we really want is a Filter or Buffer class that connects an InputStream and an OutputStream with a bounded or unbounded buffer, and provides the appropriate notifications. This could replace ListInputStream and ListOutputStream, or they could be left in. One issue is whether we also want a non-copying buffer that puts the actual data objects that the InputStream received onto the OutputStream. This is really just a queue of data objects. |
I was thinking that it would be nice to have a single class that implements both InputStream and OutputStream with an internal buffer, but a connected pair would also work. Doesn't OutputStream.write mandate that the buffer default to non-copying? |
It's worth noting that it would be possible to set this up manually if not for issue #4202. You could create a ListInputStream and a ListOutputStream, then use InputStream.pipe to connect them. However, as is, any events added to either stream clobber the piping infrastructure. |
r10298 adds an onData callback that supports this use-case. It would still be nice to have a more direct link between a ListInputStream and a ListOutputStream, though. Added Fixed label. |
Removed Area-IO label. |
The ListOutputStream API doesn't have any way of being notified of partial data being written, or consuming said data. It's only possible to consume the entire contents() at once, and the user is only notified that this is available once the stream has been closed.
The text was updated successfully, but these errors were encountered: