Handling a body response as a stream of strings can be accomplished using BodyHandlers.ofLines(), as shown in the following snippet of code:
HttpResponse<Stream<String>> responseOfLines = client.send(
request, HttpResponse.BodyHandlers.ofLines());
System.out.println("Status code: " + responseOfLines.statusCode());
System.out.println("Body: "
+ responseOfLines.body().collect(toList()));