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:
parent
37b7a23317
commit
c5a7490809
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user