* @return
* @throws IOException
*/
public Path download(Appcast appcast, Path targetDir) throws IOException, Exception {
Path downloaded = null;
Enclosure enclosure = appcast.getLatestEnclosure();
if (enclosure != null) {
String url = enclosure.getUrl();
if (url != null && !url.isEmpty()) {
URL enclosureUrl = new URL(url);
String targetName = FilenameUtils.getName(enclosureUrl.toString());
long length = enclosure.getLength();
File tmpFile = null;
ReadableByteChannel rbc = null;
FileOutputStream fos = null;
try {