summaryrefslogtreecommitdiffstats
path: root/libjava/java/nio/MappedByteBufferImpl.java
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-09 13:40:29 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-09 13:40:29 +0000
commitd1490347820d72c03db65c95f348af7e14d5618c (patch)
treec31d17690c1b5f17448be3c1f8e58e48109d8857 /libjava/java/nio/MappedByteBufferImpl.java
parent48bd6865040e0f0943dbdec27826004d68896e5f (diff)
downloadppe42-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/MappedByteBufferImpl.java')
-rw-r--r--libjava/java/nio/MappedByteBufferImpl.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/libjava/java/nio/MappedByteBufferImpl.java b/libjava/java/nio/MappedByteBufferImpl.java
index 5932c99f6d0..5ed579bb0e9 100644
--- a/libjava/java/nio/MappedByteBufferImpl.java
+++ b/libjava/java/nio/MappedByteBufferImpl.java
@@ -68,9 +68,9 @@ final class MappedByteBufferImpl extends MappedByteBuffer
public byte get ()
{
+ checkForUnderflow();
+
int pos = position();
- if (pos >= limit())
- throw new BufferUnderflowException();
byte result = DirectByteBufferImpl.getImpl(address, pos);
position (pos + 1);
return result;
@@ -78,9 +78,10 @@ final class MappedByteBufferImpl extends MappedByteBuffer
public ByteBuffer put (byte value)
{
+ checkIfReadOnly();
+ checkForOverflow();
+
int pos = position();
- if (pos >= limit())
- throw new BufferUnderflowException();
DirectByteBufferImpl.putImpl(address, pos, value);
position(pos + 1);
return this;
@@ -88,17 +89,15 @@ final class MappedByteBufferImpl extends MappedByteBuffer
public byte get (int index)
{
- if (index >= limit())
- throw new BufferUnderflowException();
+ checkIndex(index);
+
return DirectByteBufferImpl.getImpl(address, index);
}
public ByteBuffer get (byte[] dst, int offset, int length)
{
- if (offset < 0 || length < 0 || offset + length > dst.length)
- throw new IndexOutOfBoundsException ();
- if (length > remaining())
- throw new BufferUnderflowException();
+ checkArraySize(dst.length, offset, length);
+ checkForUnderflow(length);
int index = position();
DirectByteBufferImpl.getImpl(address, index, dst, offset, length);
@@ -109,8 +108,9 @@ final class MappedByteBufferImpl extends MappedByteBuffer
public ByteBuffer put (int index, byte value)
{
- if (index >= limit())
- throw new BufferUnderflowException();
+ checkIfReadOnly();
+ checkIndex(index);
+
DirectByteBufferImpl.putImpl(address, index, value);
return this;
}
OpenPOWER on IntegriCloud