In this answer, a guy suggested using IOUtils.copy but he did not close OutputStream. Here's his example:
InputStream is = new URL(imgUrl).openStream();
OutputStream os = servletResponse.getOutputStream();
IOUtils.copy(is, os);
is.close();
I checked javadocs for the copy method in IOUtils and there is no information that OutputStream will be closed automaticaly so I'm curious is it required to close OutputStream in that sample?