I edited the code above to fix the resource leak, and to avoid a FindBugs warning about use of the default charset (which is fine in this case).