8240921: Minor correction to HttpResponse.BodySubscribers example

The fix updates the incorrect example of the usage of the class java.net.http.HttpResponse.BodySubscribers.

Reviewed-by: chegar, dfuchs, jboes, pconcannon
This commit is contained in:
Rahul Yadav 2020-03-20 20:16:34 +00:00 committed by Patrick Concannon
parent 37b7a23317
commit c5a7490809
2 changed files with 6 additions and 6 deletions
src/java.net.http/share/classes/java/net/http
test/jdk/java/net/httpclient/examples

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -891,8 +891,8 @@ public interface HttpResponse<T> {
* objects:
*
* <pre>{@code // Streams the response body to a File
* HttpResponse<byte[]> response = client
* .send(request, responseInfo -> BodySubscribers.ofByteArray());
* HttpResponse<Path> response = client
* .send(request, responseInfo -> BodySubscribers.ofFile(Paths.get("example.html"));
*
* // Accumulates the response body and returns it as a byte[]
* HttpResponse<byte[]> response = client

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -165,8 +165,8 @@ public class JavadocExamples {
// HttpResponse.BodySubscribers class-level description
// Streams the response body to a File
HttpResponse<byte[]> response5 = client
.send(request, responseInfo -> BodySubscribers.ofByteArray());
HttpResponse<Path> response5 = client
.send(request, responseInfo -> BodySubscribers.ofFile(Paths.get("example.html")));
// Accumulates the response body and returns it as a byte[]
HttpResponse<byte[]> response6 = client