src/java.base/share/classes/java/io/BufferedReader.java
changeset 58288 48e480e56aad
parent 58242 94bb65cb37d3
child 58443 ed0058d06107
equal deleted inserted replaced
58287:a7f16447085e 58288:48e480e56aad
   233      *
   233      *
   234      * <p> This method implements the general contract of the corresponding
   234      * <p> This method implements the general contract of the corresponding
   235      * <code>{@link Reader#read(char[], int, int) read}</code> method of the
   235      * <code>{@link Reader#read(char[], int, int) read}</code> method of the
   236      * <code>{@link Reader}</code> class.  As an additional convenience, it
   236      * <code>{@link Reader}</code> class.  As an additional convenience, it
   237      * attempts to read as many characters as possible by repeatedly invoking
   237      * attempts to read as many characters as possible by repeatedly invoking
   238      * the <code>read</code> method of the underlying stream.  This iterated
   238      * the {@code read} method of the underlying stream.  This iterated
   239      * <code>read</code> continues until one of the following conditions becomes
   239      * {@code read} continues until one of the following conditions becomes
   240      * true: <ul>
   240      * true: <ul>
   241      *
   241      *
   242      *   <li> The specified number of characters have been read,
   242      *   <li> The specified number of characters have been read,
   243      *
   243      *
   244      *   <li> The <code>read</code> method of the underlying stream returns
   244      *   <li> The {@code read} method of the underlying stream returns
   245      *   <code>-1</code>, indicating end-of-file, or
   245      *   {@code -1}, indicating end-of-file, or
   246      *
   246      *
   247      *   <li> The <code>ready</code> method of the underlying stream
   247      *   <li> The {@code ready} method of the underlying stream
   248      *   returns <code>false</code>, indicating that further input requests
   248      *   returns {@code false}, indicating that further input requests
   249      *   would block.
   249      *   would block.
   250      *
   250      *
   251      * </ul> If the first <code>read</code> on the underlying stream returns
   251      * </ul> If the first {@code read} on the underlying stream returns
   252      * <code>-1</code> to indicate end-of-file then this method returns
   252      * {@code -1} to indicate end-of-file then this method returns
   253      * <code>-1</code>.  Otherwise this method returns the number of characters
   253      * {@code -1}.  Otherwise this method returns the number of characters
   254      * actually read.
   254      * actually read.
   255      *
   255      *
   256      * <p> Subclasses of this class are encouraged, but not required, to
   256      * <p> Subclasses of this class are encouraged, but not required, to
   257      * attempt to read as many characters as possible in the same fashion.
   257      * attempt to read as many characters as possible in the same fashion.
   258      *
   258      *
   259      * <p> Ordinarily this method takes characters from this stream's character
   259      * <p> Ordinarily this method takes characters from this stream's character
   260      * buffer, filling it from the underlying stream as necessary.  If,
   260      * buffer, filling it from the underlying stream as necessary.  If,
   261      * however, the buffer is empty, the mark is not valid, and the requested
   261      * however, the buffer is empty, the mark is not valid, and the requested
   262      * length is at least as large as the buffer, then this method will read
   262      * length is at least as large as the buffer, then this method will read
   263      * characters directly from the underlying stream into the given array.
   263      * characters directly from the underlying stream into the given array.
   264      * Thus redundant <code>BufferedReader</code>s will not copy data
   264      * Thus redundant {@code BufferedReader}s will not copy data
   265      * unnecessarily.
   265      * unnecessarily.
   266      *
   266      *
   267      * @param      cbuf  Destination buffer
   267      * @param      cbuf  Destination buffer
   268      * @param      off   Offset at which to start storing characters
   268      * @param      off   Offset at which to start storing characters
   269      * @param      len   Maximum number of characters to read
   269      * @param      len   Maximum number of characters to read
   401      *
   401      *
   402      * @param  n  The number of characters to skip
   402      * @param  n  The number of characters to skip
   403      *
   403      *
   404      * @return    The number of characters actually skipped
   404      * @return    The number of characters actually skipped
   405      *
   405      *
   406      * @throws     IllegalArgumentException  If <code>n</code> is negative.
   406      * @throws     IllegalArgumentException  If {@code n} is negative.
   407      * @throws     IOException  If an I/O error occurs
   407      * @throws     IOException  If an I/O error occurs
   408      */
   408      */
   409     public long skip(long n) throws IOException {
   409     public long skip(long n) throws IOException {
   410         if (n < 0L) {
   410         if (n < 0L) {
   411             throw new IllegalArgumentException("skip value is negative");
   411             throw new IllegalArgumentException("skip value is negative");