src/java.base/share/classes/java/nio/Buffer.java
Print this page
*** 237,247 ****
* @return This buffer
*
* @throws IllegalArgumentException
* If the preconditions on <tt>newPosition</tt> do not hold
*/
! public final Buffer position(int newPosition) {
if ((newPosition > limit) || (newPosition < 0))
throw new IllegalArgumentException();
position = newPosition;
if (mark > position) mark = -1;
return this;
--- 237,247 ----
* @return This buffer
*
* @throws IllegalArgumentException
* If the preconditions on <tt>newPosition</tt> do not hold
*/
! public Buffer position(int newPosition) {
if ((newPosition > limit) || (newPosition < 0))
throw new IllegalArgumentException();
position = newPosition;
if (mark > position) mark = -1;
return this;
*** 268,278 ****
* @return This buffer
*
* @throws IllegalArgumentException
* If the preconditions on <tt>newLimit</tt> do not hold
*/
! public final Buffer limit(int newLimit) {
if ((newLimit > capacity) || (newLimit < 0))
throw new IllegalArgumentException();
limit = newLimit;
if (position > limit) position = limit;
if (mark > limit) mark = -1;
--- 268,278 ----
* @return This buffer
*
* @throws IllegalArgumentException
* If the preconditions on <tt>newLimit</tt> do not hold
*/
! public Buffer limit(int newLimit) {
if ((newLimit > capacity) || (newLimit < 0))
throw new IllegalArgumentException();
limit = newLimit;
if (position > limit) position = limit;
if (mark > limit) mark = -1;
*** 282,292 ****
/**
* Sets this buffer's mark at its position.
*
* @return This buffer
*/
! public final Buffer mark() {
mark = position;
return this;
}
/**
--- 282,292 ----
/**
* Sets this buffer's mark at its position.
*
* @return This buffer
*/
! public Buffer mark() {
mark = position;
return this;
}
/**
*** 298,308 ****
* @return This buffer
*
* @throws InvalidMarkException
* If the mark has not been set
*/
! public final Buffer reset() {
int m = mark;
if (m < 0)
throw new InvalidMarkException();
position = m;
return this;
--- 298,308 ----
* @return This buffer
*
* @throws InvalidMarkException
* If the mark has not been set
*/
! public Buffer reset() {
int m = mark;
if (m < 0)
throw new InvalidMarkException();
position = m;
return this;
*** 323,333 ****
* is named as if it did because it will most often be used in situations
* in which that might as well be the case. </p>
*
* @return This buffer
*/
! public final Buffer clear() {
position = 0;
limit = capacity;
mark = -1;
return this;
}
--- 323,333 ----
* is named as if it did because it will most often be used in situations
* in which that might as well be the case. </p>
*
* @return This buffer
*/
! public Buffer clear() {
position = 0;
limit = capacity;
mark = -1;
return this;
}
*** 351,361 ****
* java.nio.ByteBuffer#compact compact} method when transferring data from
* one place to another. </p>
*
* @return This buffer
*/
! public final Buffer flip() {
limit = position;
position = 0;
mark = -1;
return this;
}
--- 351,361 ----
* java.nio.ByteBuffer#compact compact} method when transferring data from
* one place to another. </p>
*
* @return This buffer
*/
! public Buffer flip() {
limit = position;
position = 0;
mark = -1;
return this;
}
*** 373,383 ****
* buf.rewind(); // Rewind buffer
* buf.get(array); // Copy data into array</pre></blockquote>
*
* @return This buffer
*/
! public final Buffer rewind() {
position = 0;
mark = -1;
return this;
}
--- 373,383 ----
* buf.rewind(); // Rewind buffer
* buf.get(array); // Copy data into array</pre></blockquote>
*
* @return This buffer
*/
! public Buffer rewind() {
position = 0;
mark = -1;
return this;
}