aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/nio/DoubleBufferImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/nio/DoubleBufferImpl.java')
-rw-r--r--libjava/java/nio/DoubleBufferImpl.java26
1 files changed, 18 insertions, 8 deletions
diff --git a/libjava/java/nio/DoubleBufferImpl.java b/libjava/java/nio/DoubleBufferImpl.java
index 81fde6db6e6..504ee8d61b0 100644
--- a/libjava/java/nio/DoubleBufferImpl.java
+++ b/libjava/java/nio/DoubleBufferImpl.java
@@ -1,5 +1,5 @@
/* DoubleBufferImpl.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 DoubleBufferImpl extends DoubleBuffer
}
/**
- * Relative get method. Reads the next <code>double</code> from the buffer.
+ * Reads the <code>double</code> at this buffer's current position,
+ * and then increments the position.
+ *
+ * @exception BufferUnderflowException If there are no remaining
+ * <code>double</code>s in this buffer.
*/
public double get ()
{
+ checkForUnderflow();
+
double result = backing_buffer [position ()];
position (position () + 1);
return result;
@@ -110,13 +116,15 @@ final class DoubleBufferImpl extends DoubleBuffer
/**
* 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 DoubleBuffer put (double value)
{
- if (readOnly)
- throw new ReadOnlyBufferException ();
+ checkIfReadOnly();
+ checkForOverflow();
backing_buffer [position ()] = value;
position (position () + 1);
@@ -132,6 +140,8 @@ final class DoubleBufferImpl extends DoubleBuffer
*/
public double get (int index)
{
+ checkIndex(index);
+
return backing_buffer [index];
}
@@ -145,9 +155,9 @@ final class DoubleBufferImpl extends DoubleBuffer
*/
public DoubleBuffer put (int index, double value)
{
- if (readOnly)
- throw new ReadOnlyBufferException ();
-
+ checkIfReadOnly();
+ checkIndex(index);
+
backing_buffer [index] = value;
return this;
}