{
outWriter.write(buf, 0, nread);
}
outWriter.close();
log.info("saved content to " + outfile.getAbsolutePath());
return new ContentId(subdirectory, filename);
}
catch (IOException e) {
tryToClean(outfile, outWriter);
throw new ContentServiceException("error writing file: " + outfile.getAbsolutePath(), e);
}