diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-20 11:37:41 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-20 11:37:41 +0000 |
commit | d614d646f4cfd00edd308bbe987332271125e584 (patch) | |
tree | 009937b32fd6b3926fccb11ba8049b174994633b /libjava/java/io/PushbackReader.java | |
parent | 558ba71fcc3a92c7fa4ca6fb0d5f0d076dde762f (diff) | |
download | gcc-d614d646f4cfd00edd308bbe987332271125e584.tar.gz |
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/io/BufferedWriter.java,
java/io/ByteArrayInputStream.java,
java/io/CharArrayWriter.java,
java/io/DataInput.java,
java/io/DataInputStream.java,
java/io/File.java,
java/io/FilterInputStream.java,
java/io/InputStream.java,
java/io/InputStreamReader.java,
java/io/ObjectInputStream.java,
java/io/ObjectStreamClass.java,
java/io/PipedInputStream.java,
java/io/PipedReader.java,
java/io/PushbackInputStream.java,
java/io/PushbackReader.java,
java/io/RandomAccessFile.java,
java/io/SerializablePermission.java,
java/io/StreamTokenizer.java,
java/io/StringWriter.java,
java/io/WriteAbortedException.java,
java/io/Writer.java:
Fixed javadocs all over, rename arguments to match javadocs,
fixed coding style.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80897 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/PushbackReader.java')
-rw-r--r-- | libjava/java/io/PushbackReader.java | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/libjava/java/io/PushbackReader.java b/libjava/java/io/PushbackReader.java index 4b442e52c6f..cc2473a6c34 100644 --- a/libjava/java/io/PushbackReader.java +++ b/libjava/java/io/PushbackReader.java @@ -266,33 +266,34 @@ public class PushbackReader extends FilterReader * of the chars requested, the remaining chars are read from the * underlying stream. * - * @param buf The array into which the chars read should be stored + * @param buffer The array into which the chars read should be stored * @param offset The offset into the array to start storing chars - * @param len The requested number of chars to read + * @param length The requested number of chars to read * * @return The actual number of chars read, or -1 if end of stream. * * @exception IOException If an error occurs. */ - public synchronized int read(char[] b, int offset, int len) throws IOException + public synchronized int read(char[] buffer, int offset, int length) + throws IOException { synchronized (lock) { if (buf == null) throw new IOException("stream closed"); - if (offset < 0 || len < 0 || offset + len > b.length) + if (offset < 0 || length < 0 || offset + length > buffer.length) throw new ArrayIndexOutOfBoundsException(); - int numBytes = Math.min(buf.length - pos, len); + int numBytes = Math.min(buf.length - pos, length); if (numBytes > 0) { - System.arraycopy (buf, pos, b, offset, numBytes); + System.arraycopy (buf, pos, buffer, offset, numBytes); pos += numBytes; return numBytes; } - return super.read(b, offset, len); + return super.read(buffer, offset, length); } } @@ -353,30 +354,30 @@ public class PushbackReader extends FilterReader * If the pushback buffer cannot hold all of the requested chars, an * exception is thrown. * - * @param buf The char array to be pushed back + * @param buffer The char array to be pushed back * @param offset The index into the array where the chars to be push start - * @param len The number of chars to be pushed. + * @param length The number of chars to be pushed. * * @exception IOException If the pushback buffer is full */ - public synchronized void unread(char[] b, int offset, int len) + public synchronized void unread(char[] buffer, int offset, int length) throws IOException { synchronized (lock) { if (buf == null) throw new IOException("stream closed"); - if (pos < len) + if (pos < length) throw new IOException("Pushback buffer is full"); // Note the order that these chars are being added is the opposite // of what would be done if they were added to the buffer one at a time. // See the Java Class Libraries book p. 1397. - System.arraycopy(b, offset, buf, pos - len, len); + System.arraycopy(buffer, offset, buf, pos - length, length); // Don't put this into the arraycopy above, an exception might be thrown // and in that case we don't want to modify pos. - pos -= len; + pos -= length; } } } |