[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commit-cp] [bug #12940] ByteBuffer.asReadOnlyBuffer fails when not mark
From: |
Ewout Prangsma |
Subject: |
[commit-cp] [bug #12940] ByteBuffer.asReadOnlyBuffer fails when not marked |
Date: |
Mon, 2 May 2005 19:13:01 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3 |
Follow-up Comment #2, bug #12940 (project classpath):
This implementation of duplicate(boolean) solves it.
private ByteBuffer duplicate(boolean readOnly)
{
int pos = position();
// @classpath-bugfix Changed mark detection
// reset();
// int mark = position();
// position(pos);
int mark = this.mark;
DirectByteBufferImpl result;
if (readOnly)
result = new DirectByteBufferImpl.ReadOnly(owner, address,
capacity(),
limit(), pos);
else
result = new DirectByteBufferImpl.ReadWrite(owner, address,
capacity(),
limit(), pos);
// @classpath-bugfix Added mark >= 0
if ((mark != pos) && (mark >= 0))
{
result.position(mark);
result.mark();
result.position(pos);
}
return result;
}
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=12940>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/