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
This commit is contained in:
committed by
Michael Koch
parent
e484d7d5b3
commit
23c41c0833
@@ -1,5 +1,5 @@
|
||||
/* CharBufferImpl.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.
|
||||
|
||||
@@ -116,10 +116,16 @@ final class CharBufferImpl extends CharBuffer
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative get method. Reads the next <code>char</code> from the buffer.
|
||||
* Reads the <code>char</code> at this buffer's current position,
|
||||
* and then increments the position.
|
||||
*
|
||||
* @exception BufferUnderflowException If there are no remaining
|
||||
* <code>char</code>s in this buffer.
|
||||
*/
|
||||
public char get ()
|
||||
{
|
||||
checkForUnderflow();
|
||||
|
||||
char result = backing_buffer [position ()];
|
||||
position (position () + 1);
|
||||
return result;
|
||||
@@ -133,8 +139,7 @@ final class CharBufferImpl extends CharBuffer
|
||||
*/
|
||||
public CharBuffer put (char value)
|
||||
{
|
||||
if (readOnly)
|
||||
throw new ReadOnlyBufferException ();
|
||||
checkIfReadOnly();
|
||||
|
||||
backing_buffer [position ()] = value;
|
||||
position (position () + 1);
|
||||
@@ -145,20 +150,20 @@ final class CharBufferImpl extends CharBuffer
|
||||
* Absolute get method. Reads the <code>char</code> at position
|
||||
* <code>index</code>.
|
||||
*
|
||||
* @param index Position to read the <code>char</code> from.
|
||||
*
|
||||
* @exception IndexOutOfBoundsException If index is negative or not smaller
|
||||
* than the buffer's limit.
|
||||
*/
|
||||
public char get (int index)
|
||||
{
|
||||
if (index < 0
|
||||
|| index >= limit ())
|
||||
throw new IndexOutOfBoundsException ();
|
||||
checkIndex(index);
|
||||
|
||||
return backing_buffer [index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute put method. Writes <code>value</value> to position
|
||||
* Absolute put method. Writes <code>value</code> to position
|
||||
* <code>index</code> in the buffer.
|
||||
*
|
||||
* @exception IndexOutOfBoundsException If index is negative or not smaller
|
||||
@@ -167,12 +172,8 @@ final class CharBufferImpl extends CharBuffer
|
||||
*/
|
||||
public CharBuffer put (int index, char value)
|
||||
{
|
||||
if (index < 0
|
||||
|| index >= limit ())
|
||||
throw new IndexOutOfBoundsException ();
|
||||
|
||||
if (readOnly)
|
||||
throw new ReadOnlyBufferException ();
|
||||
checkIndex(index);
|
||||
checkIfReadOnly();
|
||||
|
||||
backing_buffer [index] = value;
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user