Ok to not close a BufferedInputStream?

I want to write a utlity method that accepts an InputStream, reads from it, but does not close it.

How can I buffer the reading?

If I wrap the InputStream in a BufferedInputStream I can't call close() on it, because that would also close the underlying InputStream.

So is it ok in this case to not close the buffered stream or will any resources be held until eventually the garbage collector kicks in?

[428 byte] By [Stephen_Friedricha] at [2007-11-26 19:51:18]
# 1
You don't need to close it but be aware that it will read-ahead to fill its buffer, so anybody else trying to read the underlying input stream may lose data. Better to organize things so that the InputStream being passed around is a BufferedInputStream to begin with.
ejpa at 2007-7-9 22:41:14 > top of Java-index,Core,Core APIs...