src/java.base/share/classes/java/io/Reader.java

Print this page




 136      *
 137      * @exception   IOException  If an I/O error occurs
 138      */
 139     public int read(char cbuf[]) throws IOException {
 140         return read(cbuf, 0, cbuf.length);
 141     }
 142 
 143     /**
 144      * Reads characters into a portion of an array.  This method will block
 145      * until some input is available, an I/O error occurs, or the end of the
 146      * stream is reached.
 147      *
 148      * @param      cbuf  Destination buffer
 149      * @param      off   Offset at which to start storing characters
 150      * @param      len   Maximum number of characters to read
 151      *
 152      * @return     The number of characters read, or -1 if the end of the
 153      *             stream has been reached
 154      *
 155      * @exception  IOException  If an I/O error occurs




 156      */
 157     abstract public int read(char cbuf[], int off, int len) throws IOException;
 158 
 159     /** Maximum skip-buffer size */
 160     private static final int maxSkipBufferSize = 8192;
 161 
 162     /** Skip buffer, null until allocated */
 163     private char skipBuffer[] = null;
 164 
 165     /**
 166      * Skips characters.  This method will block until some characters are
 167      * available, an I/O error occurs, or the end of the stream is reached.
 168      *
 169      * @param  n  The number of characters to skip
 170      *
 171      * @return    The number of characters actually skipped
 172      *
 173      * @exception  IllegalArgumentException  If <code>n</code> is negative.
 174      * @exception  IOException  If an I/O error occurs
 175      */




 136      *
 137      * @exception   IOException  If an I/O error occurs
 138      */
 139     public int read(char cbuf[]) throws IOException {
 140         return read(cbuf, 0, cbuf.length);
 141     }
 142 
 143     /**
 144      * Reads characters into a portion of an array.  This method will block
 145      * until some input is available, an I/O error occurs, or the end of the
 146      * stream is reached.
 147      *
 148      * @param      cbuf  Destination buffer
 149      * @param      off   Offset at which to start storing characters
 150      * @param      len   Maximum number of characters to read
 151      *
 152      * @return     The number of characters read, or -1 if the end of the
 153      *             stream has been reached
 154      *
 155      * @exception  IOException  If an I/O error occurs
 156      * @exception  IndexOutOfBoundsException
 157      *             If {@code off} is negative, or {@code len} is negative,
 158      *             or {@code off+len} is negative or greater than the length
 159      *             of the given array
 160      */
 161     abstract public int read(char cbuf[], int off, int len) throws IOException;
 162 
 163     /** Maximum skip-buffer size */
 164     private static final int maxSkipBufferSize = 8192;
 165 
 166     /** Skip buffer, null until allocated */
 167     private char skipBuffer[] = null;
 168 
 169     /**
 170      * Skips characters.  This method will block until some characters are
 171      * available, an I/O error occurs, or the end of the stream is reached.
 172      *
 173      * @param  n  The number of characters to skip
 174      *
 175      * @return    The number of characters actually skipped
 176      *
 177      * @exception  IllegalArgumentException  If <code>n</code> is negative.
 178      * @exception  IOException  If an I/O error occurs
 179      */