When using HttpURLConnection does the InputStream need to be closed if we do not \'get\' and use it?
i.e. is this safe?
HttpURLConnection conn = (Htt
is it safe to close an InputStream before all of it's content has been read
You need to read all of the data in the input stream before you close it so that the underlying TCP connection gets cached. I have read that it should not be required in latest Java, but it was always mandated to read the whole response for connection re-use.
Check this post: keep-alive in java6