5087440: java.io bulk read(...) end-of-stream return value descriptions ambiguous

Reviewed-by: rriggs, lancea
This commit is contained in:
Brian Burkhalter 2022-04-04 18:54:36 +00:00
parent 36b9baa70d
commit f76f5da016
3 changed files with 14 additions and 9 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -62,8 +62,9 @@ public interface ObjectInput extends DataInput, AutoCloseable {
* Reads into an array of bytes. This method will * Reads into an array of bytes. This method will
* block until some input is available. * block until some input is available.
* @param b the buffer into which the data is read * @param b the buffer into which the data is read
* @return the actual number of bytes read, -1 is * @return the total number of bytes read into the buffer, or
* returned when the end of the stream is reached. * {@code -1} if there is no more data because the end of
* the stream has been reached.
* @throws IOException If an I/O error has occurred. * @throws IOException If an I/O error has occurred.
*/ */
public int read(byte[] b) throws IOException; public int read(byte[] b) throws IOException;
@ -74,8 +75,9 @@ public interface ObjectInput extends DataInput, AutoCloseable {
* @param b the buffer into which the data is read * @param b the buffer into which the data is read
* @param off the start offset of the data * @param off the start offset of the data
* @param len the maximum number of bytes read * @param len the maximum number of bytes read
* @return the actual number of bytes read, -1 is * @return the total number of bytes read into the buffer, or
* returned when the end of the stream is reached. * {@code -1} if there is no more data because the end of
* the stream has been reached.
* @throws IOException If an I/O error has occurred. * @throws IOException If an I/O error has occurred.
*/ */
public int read(byte[] b, int off, int len) throws IOException; public int read(byte[] b, int off, int len) throws IOException;

View file

@ -1031,8 +1031,9 @@ public class ObjectInputStream
* @param buf the buffer into which the data is read * @param buf the buffer into which the data is read
* @param off the start offset in the destination array {@code buf} * @param off the start offset in the destination array {@code buf}
* @param len the maximum number of bytes read * @param len the maximum number of bytes read
* @return the actual number of bytes read, -1 is returned when the end of * @return the total number of bytes read into the buffer, or
* the stream is reached. * {@code -1} if there is no more data because the end of
* the stream has been reached.
* @throws NullPointerException if {@code buf} is {@code null}. * @throws NullPointerException if {@code buf} is {@code null}.
* @throws IndexOutOfBoundsException if {@code off} is negative, * @throws IndexOutOfBoundsException if {@code off} is negative,
* {@code len} is negative, or {@code len} is greater than * {@code len} is negative, or {@code len} is greater than

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -177,7 +177,9 @@ public class SequenceInputStream extends InputStream {
* @param off the start offset in array {@code b} * @param off the start offset in array {@code b}
* at which the data is written. * at which the data is written.
* @param len the maximum number of bytes read. * @param len the maximum number of bytes read.
* @return int the number of bytes read. * @return the total number of bytes read into the buffer, or
* {@code -1} if there is no more data because the end of
* the last contained stream has been reached.
* @throws NullPointerException If {@code b} is {@code null}. * @throws NullPointerException If {@code b} is {@code null}.
* @throws IndexOutOfBoundsException If {@code off} is negative, * @throws IndexOutOfBoundsException If {@code off} is negative,
* {@code len} is negative, or {@code len} is * {@code len} is negative, or {@code len} is