InputStream.read will not always have read all data after calling it
once. Changed to IOutils.copy method.