diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-09 13:40:29 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-09 13:40:29 +0000 |
commit | d1490347820d72c03db65c95f348af7e14d5618c (patch) | |
tree | c31d17690c1b5f17448be3c1f8e58e48109d8857 /libjava/java/nio/IntBufferImpl.java | |
parent | 48bd6865040e0f0943dbdec27826004d68896e5f (diff) | |
download | ppe42-gcc-d1490347820d72c03db65c95f348af7e14d5618c.tar.gz ppe42-gcc-d1490347820d72c03db65c95f348af7e14d5618c.zip |
2004-07-09 Dalibor Topic <robilad@kaffe.org>
* java/nio/Buffer.java,
java/nio/ByteBuffer.java,
java/nio/ByteBufferHelper.java,
java/nio/ByteBufferImpl.java,
java/nio/CharBuffer.java,
java/nio/CharBufferImpl.java,
java/nio/CharViewBufferImpl.java,
java/nio/DirectByteBufferImpl.java,
java/nio/DoubleBuffer.java,
java/nio/DoubleBufferImpl.java,
java/nio/DoubleViewBufferImpl.java,
java/nio/FloatBuffer.java,
java/nio/FloatBufferImpl.java,
java/nio/FloatViewBufferImpl.java,
java/nio/IntBuffer.java,
java/nio/IntBufferImpl.java,
java/nio/IntViewBufferImpl.java,
java/nio/LongBuffer.java,
java/nio/LongBufferImpl.java,
java/nio/LongViewBufferImpl.java,
java/nio/MappedByteBufferImpl.java,
java/nio/ShortBuffer.java,
java/nio/ShortBufferImpl.java,
java/nio/ShortViewBufferImpl.java:
Fixed javadocs all over. Improved input error
checking.
* java/nio/Buffer.java
(checkForUnderflow, checkForOverflow, checkIndex,
checkIfReadOnly, checkArraySize): New helper methods
for error checking.
* java/nio/ByteBufferHelper.java
(checkRemainingForRead, checkRemainingForWrite,
checkAvailableForRead, checkAvailableForWrite): Removed
no longer needed methods.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84366 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/nio/IntBufferImpl.java')
-rw-r--r-- | libjava/java/nio/IntBufferImpl.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/libjava/java/nio/IntBufferImpl.java b/libjava/java/nio/IntBufferImpl.java index a491c1105c4..f68dd92fa04 100644 --- a/libjava/java/nio/IntBufferImpl.java +++ b/libjava/java/nio/IntBufferImpl.java @@ -1,5 +1,5 @@ /* IntBufferImpl.java -- - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -98,10 +98,16 @@ final class IntBufferImpl extends IntBuffer } /** - * Relative get method. Reads the next <code>int</code> from the buffer. + * Reads the <code>int</code> at this buffer's current position, + * and then increments the position. + * + * @exception BufferUnderflowException If there are no remaining + * <code>ints</code> in this buffer. */ public int get () { + checkForUnderflow(); + int result = backing_buffer [position ()]; position (position () + 1); return result; @@ -110,14 +116,16 @@ final class IntBufferImpl extends IntBuffer /** * Relative put method. Writes <code>value</code> to the next position * in the buffer. - * + * + * @exception BufferOverflowException If there no remaining + * space in this buffer. * @exception ReadOnlyBufferException If this buffer is read-only. */ public IntBuffer put (int value) { - if (readOnly) - throw new ReadOnlyBufferException (); - + checkIfReadOnly(); + checkForOverflow(); + backing_buffer [position ()] = value; position (position () + 1); return this; @@ -132,6 +140,8 @@ final class IntBufferImpl extends IntBuffer */ public int get (int index) { + checkIndex(index); + return backing_buffer [index]; } @@ -145,9 +155,9 @@ final class IntBufferImpl extends IntBuffer */ public IntBuffer put (int index, int value) { - if (readOnly) - throw new ReadOnlyBufferException (); - + checkIfReadOnly(); + checkIndex(index); + backing_buffer [index] = value; return this; } |