< prev index next >

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

Print this page

        

*** 32,42 **** * @author Herb Jellinek * @since 1.1 */ public class CharArrayReader extends Reader { /** The character buffer. */ ! protected char buf[]; /** The current buffer position. */ protected int pos; /** The position of mark in buffer. */ --- 32,42 ---- * @author Herb Jellinek * @since 1.1 */ public class CharArrayReader extends Reader { /** The character buffer. */ ! protected char[] buf; /** The current buffer position. */ protected int pos; /** The position of mark in buffer. */
*** 50,60 **** /** * Creates a CharArrayReader from the specified array of chars. * @param buf Input buffer (not copied) */ ! public CharArrayReader(char buf[]) { this.buf = buf; this.pos = 0; this.count = buf.length; } --- 50,60 ---- /** * Creates a CharArrayReader from the specified array of chars. * @param buf Input buffer (not copied) */ ! public CharArrayReader(char[] buf) { this.buf = buf; this.pos = 0; this.count = buf.length; }
*** 73,83 **** * * @param buf Input buffer (not copied) * @param offset Offset of the first char to read * @param length Number of chars to read */ ! public CharArrayReader(char buf[], int offset, int length) { if ((offset < 0) || (offset > buf.length) || (length < 0) || ((offset + length) < 0)) { throw new IllegalArgumentException(); } this.buf = buf; --- 73,83 ---- * * @param buf Input buffer (not copied) * @param offset Offset of the first char to read * @param length Number of chars to read */ ! public CharArrayReader(char[] buf, int offset, int length) { if ((offset < 0) || (offset > buf.length) || (length < 0) || ((offset + length) < 0)) { throw new IllegalArgumentException(); } this.buf = buf;
*** 116,126 **** * the end of the stream has been reached * * @exception IOException If an I/O error occurs * @exception IndexOutOfBoundsException {@inheritDoc} */ ! public int read(char b[], int off, int len) throws IOException { synchronized (lock) { ensureOpen(); if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); --- 116,126 ---- * the end of the stream has been reached * * @exception IOException If an I/O error occurs * @exception IndexOutOfBoundsException {@inheritDoc} */ ! public int read(char[] b, int off, int len) throws IOException { synchronized (lock) { ensureOpen(); if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException();
< prev index next >