public File download()

in src/main/java/org/apache/creadur/tentacles/NexusClient.java [62:85]


    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);

        try (CloseableHttpResponse response = get(uri); InputStream content = response.getEntity().getContent()) {

            this.fileSystem.mkparent(file);

            this.ioSystem.copy(content, file);
        }

        return file;
    }