You can replace this whole `if` block content with `Utils.streamToBytes`. Don't forget to deal with closing the source input stream in a `finally` block.