From 8481d3329cbbfb07d1094b8c09e810d4a88b892c Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Wed, 17 Jan 2024 10:56:36 -0800 Subject: [PATCH] Document the JDK 9+ alternative to `ByteStreams#toByteArray` Fixes #6915 RELNOTES=n/a PiperOrigin-RevId: 599226558 --- android/guava/src/com/google/common/io/ByteStreams.java | 2 ++ guava/src/com/google/common/io/ByteStreams.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/android/guava/src/com/google/common/io/ByteStreams.java b/android/guava/src/com/google/common/io/ByteStreams.java index 640bc8bfc01a..184f7df28a47 100644 --- a/android/guava/src/com/google/common/io/ByteStreams.java +++ b/android/guava/src/com/google/common/io/ByteStreams.java @@ -233,6 +233,8 @@ private static byte[] combineBuffers(Queue bufs, int totalLen) { /** * Reads all bytes from an input stream into a byte array. Does not close the stream. * + *

Java 9+ users: use {@code in#readAllBytes()} instead. + * * @param in the input stream to read from * @return a byte array containing all the bytes from the stream * @throws IOException if an I/O error occurs diff --git a/guava/src/com/google/common/io/ByteStreams.java b/guava/src/com/google/common/io/ByteStreams.java index 640bc8bfc01a..184f7df28a47 100644 --- a/guava/src/com/google/common/io/ByteStreams.java +++ b/guava/src/com/google/common/io/ByteStreams.java @@ -233,6 +233,8 @@ private static byte[] combineBuffers(Queue bufs, int totalLen) { /** * Reads all bytes from an input stream into a byte array. Does not close the stream. * + *

Java 9+ users: use {@code in#readAllBytes()} instead. + * * @param in the input stream to read from * @return a byte array containing all the bytes from the stream * @throws IOException if an I/O error occurs