Reputation: 1080
I have a piece of code that reads some binary data via an InputStream
backed by a ByteArrayInputStream
, like this
Object do(byte[] arr) {
InputStream is = new ByteArrayInputStream(arr);
return conv(is);
I would like to avoid constructing new ByteArrayInputStream
each call and instead just load the arr
parameter into an existing member stream, however I can't find a simple way to do this. Is this or similar behaviour allowed or this against the recommended use of streams?
Upvotes: 4
Views: 2921