Ganish Patil wrote:
Please don't write code like this. Try-with-resources automatically closes your resources, and handles the exceptions that may occur during closing. Also, if an exception is thrown when
inputStream is closed,
outputStream will never be closed. The following code is more clear and robust: