Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lightweight java.io.InputStream implementation that supports mark() & reset()

Good day,

Currently, we are using ByteArrayInputStream for our reset-able InputStream. My problem with it is that it consumes a lot of memory (it loads all the bytes it represents in memory unlike some other InputStream implementations).

My question then is, is there any lighter implementation of InputStream which supports mark() & read()?

I tried searching in commons-io as well, but I fail to see any.

Thanks, Franz

like image 806
Franz See Avatar asked Jul 16 '26 00:07

Franz See


1 Answers

Would using a BufferedInputStream work for you? Without knowing where the original data is coming from (eg, why you have a ByteArrayInputStream) to begin with it is a bit hard to answer your question.

like image 192
TofuBeer Avatar answered Jul 18 '26 13:07

TofuBeer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!