*
* @param file to write to
* @throws IOException on failure
*/
public void writeTo(File file) throws IOException {
TempFileOutputStream stream = new TempFileOutputStream(file);
boolean successful = false;
try {
writeTo(stream);
successful = true;
} finally {
stream.close(successful);
}
}