src/java.base/share/classes/java/io/SequenceInputStream.java
changeset 58242 94bb65cb37d3
parent 57569 be47f3ccdf12
child 58288 48e480e56aad
equal deleted inserted replaced
58241:33de7752835c 58242:94bb65cb37d3
   116      * many bytes will not block, but may read or skip fewer bytes.
   116      * many bytes will not block, but may read or skip fewer bytes.
   117      * <p>
   117      * <p>
   118      * This method simply calls {@code available} of the current underlying
   118      * This method simply calls {@code available} of the current underlying
   119      * input stream and returns the result.
   119      * input stream and returns the result.
   120      *
   120      *
   121      * @return an estimate of the number of bytes that can be read (or
   121      * @return   an estimate of the number of bytes that can be read (or
   122      *         skipped over) from the current underlying input stream
   122      *           skipped over) from the current underlying input stream
   123      *         without blocking or {@code 0} if this input stream
   123      *           without blocking or {@code 0} if this input stream
   124      *         has been closed by invoking its {@link #close()} method
   124      *           has been closed by invoking its {@link #close()} method
   125      * @exception  IOException  if an I/O error occurs.
   125      * @throw    IOException  if an I/O error occurs.
   126      *
   126      *
   127      * @since   1.1
   127      * @since    1.1
   128      */
   128      */
   129     public int available() throws IOException {
   129     public int available() throws IOException {
   130         if (in == null) {
   130         if (in == null) {
   131             return 0; // no way to signal EOF from available()
   131             return 0; // no way to signal EOF from available()
   132         }
   132         }
   147      * method of the current substream and begins reading from the next
   147      * method of the current substream and begins reading from the next
   148      * substream.
   148      * substream.
   149      *
   149      *
   150      * @return     the next byte of data, or <code>-1</code> if the end of the
   150      * @return     the next byte of data, or <code>-1</code> if the end of the
   151      *             stream is reached.
   151      *             stream is reached.
   152      * @exception  IOException  if an I/O error occurs.
   152      * @throws     IOException  if an I/O error occurs.
   153      */
   153      */
   154     public int read() throws IOException {
   154     public int read() throws IOException {
   155         while (in != null) {
   155         while (in != null) {
   156             int c = in.read();
   156             int c = in.read();
   157             if (c != -1) {
   157             if (c != -1) {
   177      * @param      b     the buffer into which the data is read.
   177      * @param      b     the buffer into which the data is read.
   178      * @param      off   the start offset in array <code>b</code>
   178      * @param      off   the start offset in array <code>b</code>
   179      *                   at which the data is written.
   179      *                   at which the data is written.
   180      * @param      len   the maximum number of bytes read.
   180      * @param      len   the maximum number of bytes read.
   181      * @return     int   the number of bytes read.
   181      * @return     int   the number of bytes read.
   182      * @exception  NullPointerException If <code>b</code> is <code>null</code>.
   182      * @throws     NullPointerException If <code>b</code> is <code>null</code>.
   183      * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
   183      * @throws     IndexOutOfBoundsException If <code>off</code> is negative,
   184      * <code>len</code> is negative, or <code>len</code> is greater than
   184      *             <code>len</code> is negative, or <code>len</code> is
   185      * <code>b.length - off</code>
   185      *             greater than <code>b.length - off</code>
   186      * @exception  IOException  if an I/O error occurs.
   186      * @throws     IOException  if an I/O error occurs.
   187      */
   187      */
   188     public int read(byte b[], int off, int len) throws IOException {
   188     public int read(byte b[], int off, int len) throws IOException {
   189         if (in == null) {
   189         if (in == null) {
   190             return -1;
   190             return -1;
   191         } else if (b == null) {
   191         } else if (b == null) {
   215      * If this stream was created
   215      * If this stream was created
   216      * from an enumeration, all remaining elements
   216      * from an enumeration, all remaining elements
   217      * are requested from the enumeration and closed
   217      * are requested from the enumeration and closed
   218      * before the <code>close</code> method returns.
   218      * before the <code>close</code> method returns.
   219      *
   219      *
   220      * @exception  IOException  if an I/O error occurs.
   220      * @throws     IOException  if an I/O error occurs.
   221      */
   221      */
   222     public void close() throws IOException {
   222     public void close() throws IOException {
   223         IOException ioe = null;
   223         IOException ioe = null;
   224         while (in != null) {
   224         while (in != null) {
   225             try {
   225             try {