in src/main/java/org/apache/creadur/tentacles/NexusClient.java [62:95]
public File download(final URI uri, final File file) throws IOException {
if (file.exists()) {
final long length = getContentLength(uri);
if (file.length() == length) {
log.info("Exists " + uri);
return file;
} else {
log.info("Incomplete " + uri);
}
}
log.info("Download " + uri);
final CloseableHttpResponse response = get(uri);
InputStream content = null;
try {
content = response.getEntity().getContent();
this.fileSystem.mkparent(file);
this.ioSystem.copy(content, file);
} finally {
if (content != null) {
content.close();
}
response.close();
}
return file;
}