Closing inputstreams in Java -


i have following piece of code in try/catch block

 inputstream inputstream = conn.getinputstream();  inputstreamreader inputstreamreader = new  inputstreamreader(inputstream);  bufferedreader bufferedreader = new bufferedreader(inputstreamreader); 

my question when have close these streams in block, have close 3 streams or closing befferedreader close other streams ?

by convention, wrapper streams (which wrap existing streams) close underlying stream when closed, have close bufferedreader in example. also, harmless close closed stream, closing 3 streams won't hurt.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -