IOUtils has a convenience method that can do all this like in one line