Skip to content

Commit

Permalink
Remove @Beta from ByteStreams.
Browse files Browse the repository at this point in the history
Fixes #3239

RELNOTES=`io`: Remove `@Beta` from `ByteStreams`.
PiperOrigin-RevId: 523159991
  • Loading branch information
kluever authored and Google Java Core Libraries committed Apr 10, 2023
1 parent 61be35c commit 4897930
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
15 changes: 0 additions & 15 deletions android/guava/src/com/google/common/io/ByteStreams.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static java.lang.Math.max;
import static java.lang.Math.min;

import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.J2ktIncompatible;
import com.google.common.math.IntMath;
Expand Down Expand Up @@ -285,7 +284,6 @@ static byte[] toByteArray(InputStream in, long expectedSize) throws IOException
* @since 20.0
*/
@CanIgnoreReturnValue
@Beta
public static long exhaust(InputStream in) throws IOException {
long total = 0;
long read;
Expand All @@ -300,7 +298,6 @@ public static long exhaust(InputStream in) throws IOException {
* Returns a new {@link ByteArrayDataInput} instance to read from the {@code bytes} array from the
* beginning.
*/
@Beta
public static ByteArrayDataInput newDataInput(byte[] bytes) {
return newDataInput(new ByteArrayInputStream(bytes));
}
Expand All @@ -312,7 +309,6 @@ public static ByteArrayDataInput newDataInput(byte[] bytes) {
* @throws IndexOutOfBoundsException if {@code start} is negative or greater than the length of
* the array
*/
@Beta
public static ByteArrayDataInput newDataInput(byte[] bytes, int start) {
checkPositionIndex(start, bytes.length);
return newDataInput(new ByteArrayInputStream(bytes, start, bytes.length - start));
Expand All @@ -325,7 +321,6 @@ public static ByteArrayDataInput newDataInput(byte[] bytes, int start) {
*
* @since 17.0
*/
@Beta
public static ByteArrayDataInput newDataInput(ByteArrayInputStream byteArrayInputStream) {
return new ByteArrayDataInputStream(checkNotNull(byteArrayInputStream));
}
Expand Down Expand Up @@ -477,7 +472,6 @@ public String readUTF() {
}

/** Returns a new {@link ByteArrayDataOutput} instance with a default size. */
@Beta
public static ByteArrayDataOutput newDataOutput() {
return newDataOutput(new ByteArrayOutputStream());
}
Expand All @@ -488,7 +482,6 @@ public static ByteArrayDataOutput newDataOutput() {
*
* @throws IllegalArgumentException if {@code size} is negative
*/
@Beta
public static ByteArrayDataOutput newDataOutput(int size) {
// When called at high frequency, boxing size generates too much garbage,
// so avoid doing that if we can.
Expand All @@ -510,7 +503,6 @@ public static ByteArrayDataOutput newDataOutput(int size) {
*
* @since 17.0
*/
@Beta
public static ByteArrayDataOutput newDataOutput(ByteArrayOutputStream byteArrayOutputStream) {
return new ByteArrayDataOutputStream(checkNotNull(byteArrayOutputStream));
}
Expand Down Expand Up @@ -687,7 +679,6 @@ public String toString() {
*
* @since 14.0 (since 1.0 as com.google.common.io.NullOutputStream)
*/
@Beta
public static OutputStream nullOutputStream() {
return NULL_OUTPUT_STREAM;
}
Expand All @@ -700,7 +691,6 @@ public static OutputStream nullOutputStream() {
* @return a length-limited {@link InputStream}
* @since 14.0 (since 1.0 as com.google.common.io.LimitInputStream)
*/
@Beta
public static InputStream limit(InputStream in, long limit) {
return new LimitedInputStream(in, limit);
}
Expand Down Expand Up @@ -787,7 +777,6 @@ public long skip(long n) throws IOException {
* @throws EOFException if this stream reaches the end before reading all the bytes.
* @throws IOException if an I/O error occurs.
*/
@Beta
public static void readFully(InputStream in, byte[] b) throws IOException {
readFully(in, b, 0, b.length);
}
Expand All @@ -804,7 +793,6 @@ public static void readFully(InputStream in, byte[] b) throws IOException {
* @throws EOFException if this stream reaches the end before reading all the bytes.
* @throws IOException if an I/O error occurs.
*/
@Beta
public static void readFully(InputStream in, byte[] b, int off, int len) throws IOException {
int read = read(in, b, off, len);
if (read != len) {
Expand All @@ -822,7 +810,6 @@ public static void readFully(InputStream in, byte[] b, int off, int len) throws
* @throws EOFException if this stream reaches the end before skipping all the bytes
* @throws IOException if an I/O error occurs, or the stream does not support skipping
*/
@Beta
public static void skipFully(InputStream in, long n) throws IOException {
long skipped = skipUpTo(in, n);
if (skipped < n) {
Expand Down Expand Up @@ -888,7 +875,6 @@ private static long skipSafely(InputStream in, long n) throws IOException {
* @throws IOException if an I/O error occurs
* @since 14.0
*/
@Beta
@CanIgnoreReturnValue // some processors won't return a useful result
@ParametricNullness
public static <T extends @Nullable Object> T readBytes(
Expand Down Expand Up @@ -928,7 +914,6 @@ private static long skipSafely(InputStream in, long n) throws IOException {
* @throws IndexOutOfBoundsException if {@code off} is negative, if {@code len} is negative, or if
* {@code off + len} is greater than {@code b.length}
*/
@Beta
@CanIgnoreReturnValue
// Sometimes you don't care how many bytes you actually read, I guess.
// (You know that it's either going to read len bytes or stop at EOF.)
Expand Down
15 changes: 0 additions & 15 deletions guava/src/com/google/common/io/ByteStreams.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static java.lang.Math.max;
import static java.lang.Math.min;

import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.J2ktIncompatible;
import com.google.common.math.IntMath;
Expand Down Expand Up @@ -285,7 +284,6 @@ static byte[] toByteArray(InputStream in, long expectedSize) throws IOException
* @since 20.0
*/
@CanIgnoreReturnValue
@Beta
public static long exhaust(InputStream in) throws IOException {
long total = 0;
long read;
Expand All @@ -300,7 +298,6 @@ public static long exhaust(InputStream in) throws IOException {
* Returns a new {@link ByteArrayDataInput} instance to read from the {@code bytes} array from the
* beginning.
*/
@Beta
public static ByteArrayDataInput newDataInput(byte[] bytes) {
return newDataInput(new ByteArrayInputStream(bytes));
}
Expand All @@ -312,7 +309,6 @@ public static ByteArrayDataInput newDataInput(byte[] bytes) {
* @throws IndexOutOfBoundsException if {@code start} is negative or greater than the length of
* the array
*/
@Beta
public static ByteArrayDataInput newDataInput(byte[] bytes, int start) {
checkPositionIndex(start, bytes.length);
return newDataInput(new ByteArrayInputStream(bytes, start, bytes.length - start));
Expand All @@ -325,7 +321,6 @@ public static ByteArrayDataInput newDataInput(byte[] bytes, int start) {
*
* @since 17.0
*/
@Beta
public static ByteArrayDataInput newDataInput(ByteArrayInputStream byteArrayInputStream) {
return new ByteArrayDataInputStream(checkNotNull(byteArrayInputStream));
}
Expand Down Expand Up @@ -477,7 +472,6 @@ public String readUTF() {
}

/** Returns a new {@link ByteArrayDataOutput} instance with a default size. */
@Beta
public static ByteArrayDataOutput newDataOutput() {
return newDataOutput(new ByteArrayOutputStream());
}
Expand All @@ -488,7 +482,6 @@ public static ByteArrayDataOutput newDataOutput() {
*
* @throws IllegalArgumentException if {@code size} is negative
*/
@Beta
public static ByteArrayDataOutput newDataOutput(int size) {
// When called at high frequency, boxing size generates too much garbage,
// so avoid doing that if we can.
Expand All @@ -510,7 +503,6 @@ public static ByteArrayDataOutput newDataOutput(int size) {
*
* @since 17.0
*/
@Beta
public static ByteArrayDataOutput newDataOutput(ByteArrayOutputStream byteArrayOutputStream) {
return new ByteArrayDataOutputStream(checkNotNull(byteArrayOutputStream));
}
Expand Down Expand Up @@ -687,7 +679,6 @@ public String toString() {
*
* @since 14.0 (since 1.0 as com.google.common.io.NullOutputStream)
*/
@Beta
public static OutputStream nullOutputStream() {
return NULL_OUTPUT_STREAM;
}
Expand All @@ -700,7 +691,6 @@ public static OutputStream nullOutputStream() {
* @return a length-limited {@link InputStream}
* @since 14.0 (since 1.0 as com.google.common.io.LimitInputStream)
*/
@Beta
public static InputStream limit(InputStream in, long limit) {
return new LimitedInputStream(in, limit);
}
Expand Down Expand Up @@ -787,7 +777,6 @@ public long skip(long n) throws IOException {
* @throws EOFException if this stream reaches the end before reading all the bytes.
* @throws IOException if an I/O error occurs.
*/
@Beta
public static void readFully(InputStream in, byte[] b) throws IOException {
readFully(in, b, 0, b.length);
}
Expand All @@ -804,7 +793,6 @@ public static void readFully(InputStream in, byte[] b) throws IOException {
* @throws EOFException if this stream reaches the end before reading all the bytes.
* @throws IOException if an I/O error occurs.
*/
@Beta
public static void readFully(InputStream in, byte[] b, int off, int len) throws IOException {
int read = read(in, b, off, len);
if (read != len) {
Expand All @@ -822,7 +810,6 @@ public static void readFully(InputStream in, byte[] b, int off, int len) throws
* @throws EOFException if this stream reaches the end before skipping all the bytes
* @throws IOException if an I/O error occurs, or the stream does not support skipping
*/
@Beta
public static void skipFully(InputStream in, long n) throws IOException {
long skipped = skipUpTo(in, n);
if (skipped < n) {
Expand Down Expand Up @@ -888,7 +875,6 @@ private static long skipSafely(InputStream in, long n) throws IOException {
* @throws IOException if an I/O error occurs
* @since 14.0
*/
@Beta
@CanIgnoreReturnValue // some processors won't return a useful result
@ParametricNullness
public static <T extends @Nullable Object> T readBytes(
Expand Down Expand Up @@ -928,7 +914,6 @@ private static long skipSafely(InputStream in, long n) throws IOException {
* @throws IndexOutOfBoundsException if {@code off} is negative, if {@code len} is negative, or if
* {@code off + len} is greater than {@code b.length}
*/
@Beta
@CanIgnoreReturnValue
// Sometimes you don't care how many bytes you actually read, I guess.
// (You know that it's either going to read len bytes or stop at EOF.)
Expand Down

0 comments on commit 4897930

Please sign in to comment.