Closed
Description
The current use of InputStream has a few problems:
- it is non-idiomatic to split the responsibility for opening and closing a stream; it also prevents features such as try-with-resources
- it essentially forces extra byte copying in order to consume the data
I haven't looked at the implementation, but since the comments say that the InputStream is non-blocking, I assume that it is used instead of byte[] simply to prevent modifications of the data when it is passed to multiple listeners (a reasonable concern).
Since there already appears to be a Guava dependency, the obvious alternative would be to pass a (inherently read-only) ByteSource instead.
(ByteString from protobuf would be another option, but for various reasons ByteSource is probably a better choice)
Metadata
Metadata
Assignees
Labels
No labels