in iep-servergroups/src/main/java/com/netflix/iep/servergroups/JsonUtils.java [164:181]
static List<ServerGroup> parseResponse(
HttpResponse response, IOFunction<List<ServerGroup>> function) throws IOException {
String enc = response.header("Content-Encoding");
if (enc != null && enc.contains("gzip")) {
// Decompress while parsing to avoid allocating an intermediate byte array of the
// full decompressed payload.
try (
GZIPInputStream gzin = new GZIPInputStream(new ByteArrayInputStream(response.entity()));
JsonParser jp = FACTORY.createParser(gzin)
) {
return function.apply(jp);
}
} else {
try (JsonParser jp = FACTORY.createParser(response.entity())) {
return function.apply(jp);
}
}
}