public void processArtifactStream()

in src/main/java/org/apache/sling/cli/impl/nexus/RepositoryService.java [207:218]


    public void processArtifactStream(Artifact artifact, Consumer<InputStream> consumer) throws IOException {
        try (CloseableHttpClient client = httpClientFactory.newClient()) {
            HttpGet get = new HttpGet(artifact.getUri());
            try (CloseableHttpResponse response = client.execute(get)) {
                int statusCode = response.getStatusLine().getStatusCode();
                if (statusCode != 200) {
                    throw new IOException(String.format("Got %d instead of 200 when retrieving %s.", statusCode, get.getURI()));
                }
                consumer.accept(response.getEntity().getContent());
            }
        }
    }