As I've already mentioned in my above post, you need to have the null checking in order to prevent your code from having the NullPointerException.
When the code gets into line 4, and suppose that it throws an exception, it will then go to line 11 because of the finally clause, but "in" instance is still null in this case. If you don't do any null checking here, you will get NullPointerException when you try to call in.close(). Similar situation will happen in line 5. Remember, creating an instance of InputStream or OutputStream throws an exception, thus you need to either catch it or throw it.
Hopefully it's clear enough
