aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/nio/DirectByteBufferImpl.java
diff options
context:
space:
mode:
authorDalibor Topic <robilad@kaffe.org>2004-07-09 13:40:29 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2004-07-09 13:40:29 +0000
commit23c41c08339da4bdf677ade01e17d940b7ce6201 (patch)
treec31d17690c1b5f17448be3c1f8e58e48109d8857 /libjava/java/nio/DirectByteBufferImpl.java
parente484d7d5b33c3b6c9059d0e61fb08fd9e7f3bc68 (diff)
downloadgcc-23c41c08339da4bdf677ade01e17d940b7ce6201.zip
gcc-23c41c08339da4bdf677ade01e17d940b7ce6201.tar.gz
gcc-23c41c08339da4bdf677ade01e17d940b7ce6201.tar.bz2
Buffer.java, [...]: Fixed javadocs all over.
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. From-SVN: r84366
Diffstat (limited to 'libjava/java/nio/DirectByteBufferImpl.java')
-rw-r--r--libjava/java/nio/DirectByteBufferImpl.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/libjava/java/nio/DirectByteBufferImpl.java b/libjava/java/nio/DirectByteBufferImpl.java
index be0fc52..aad5dca 100644
--- a/libjava/java/nio/DirectByteBufferImpl.java
+++ b/libjava/java/nio/DirectByteBufferImpl.java
@@ -86,9 +86,9 @@ final class DirectByteBufferImpl extends ByteBuffer
public byte get ()
{
+ checkForUnderflow();
+
int pos = position();
- if (pos >= limit())
- throw new BufferUnderflowException();
byte result = getImpl (address, pos);
position (pos + 1);
return result;
@@ -96,8 +96,8 @@ final class DirectByteBufferImpl extends ByteBuffer
public byte get (int index)
{
- if (index >= limit())
- throw new BufferUnderflowException();
+ checkIndex(index);
+
return getImpl (address, index);
}
@@ -106,10 +106,8 @@ final class DirectByteBufferImpl extends ByteBuffer
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();
getImpl(address, index, dst, offset, length);
@@ -120,9 +118,10 @@ final class DirectByteBufferImpl extends ByteBuffer
public ByteBuffer put (byte value)
{
+ checkIfReadOnly();
+ checkForOverflow();
+
int pos = position();
- if (pos >= limit())
- throw new BufferUnderflowException();
putImpl (address, pos, value);
position (pos + 1);
return this;
@@ -130,8 +129,9 @@ final class DirectByteBufferImpl extends ByteBuffer
public ByteBuffer put (int index, byte value)
{
- if (index >= limit())
- throw new BufferUnderflowException();
+ checkIfReadOnly();
+ checkIndex(index);
+
putImpl (address, index, value);
return this;
}