Should I always wrap an InputStream as BufferedInputStream?

Posted by geejay on Stack Overflow See other posts from Stack Overflow or by geejay
Published on 2010-06-03T07:36:05Z Indexed on 2010/06/03 7:54 UTC
Read the original article Hit count: 236

Filed under:
|
|

Does it make sense to always wrap an InputStream as BufferedInputStream, when I know whether the given InputStream is something other than buffered? For e.g:

InputStream is = API.getFromSomewhere()
if(!(is instanceof BufferedInputStream))
  return new BufferedInputStream(is);
return is;

© Stack Overflow or respective owner

Related posts about java

Related posts about streams