public static List<String> sendGetToGzip(String url) throws IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpget = new HttpGet(url);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httpget);
} catch (IOException e1) {
e1.printStackTrace();
}
List<String> lines = new ArrayList();
try {
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream in = new GZIPInputStream(entity.getContent());
Scanner sc = new Scanner(in);
while (sc.hasNextLine()) {
lines.add(sc.nextLine());
}
in.close();
System.out.println(lines.toString());
}
} catch (IOException e) {
throw e;
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return lines;
}