mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix compact() operation on NIO buffers
This commit is contained in:
parent
389b55be91
commit
6145afcbf8
|
@ -90,15 +90,15 @@ class TByteBufferImpl extends TByteBuffer {
|
|||
if (readOnly) {
|
||||
throw new TReadOnlyBufferException();
|
||||
}
|
||||
int sz = remaining();
|
||||
if (position > 0) {
|
||||
int sz = remaining();
|
||||
int dst = start;
|
||||
int src = start + position;
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
array[dst++] = array[src++];
|
||||
}
|
||||
position = sz;
|
||||
}
|
||||
position = sz;
|
||||
limit = capacity;
|
||||
mark = -1;
|
||||
return this;
|
||||
|
|
|
@ -82,14 +82,14 @@ abstract class TCharBufferImpl extends TCharBuffer {
|
|||
if (isReadOnly()) {
|
||||
throw new TReadOnlyBufferException();
|
||||
}
|
||||
int sz = remaining();
|
||||
if (position > 0) {
|
||||
int sz = remaining();
|
||||
int src = position;
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
putChar(i, getChar(src++));
|
||||
}
|
||||
position = sz;
|
||||
}
|
||||
position = sz;
|
||||
limit = capacity;
|
||||
mark = -1;
|
||||
return this;
|
||||
|
|
|
@ -82,14 +82,14 @@ abstract class TDoubleBufferImpl extends TDoubleBuffer {
|
|||
if (isReadOnly()) {
|
||||
throw new TReadOnlyBufferException();
|
||||
}
|
||||
int sz = remaining();
|
||||
if (position > 0) {
|
||||
int sz = remaining();
|
||||
int src = position;
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
putElement(i, getElement(src++));
|
||||
}
|
||||
position = sz;
|
||||
}
|
||||
position = sz;
|
||||
limit = capacity;
|
||||
mark = -1;
|
||||
return this;
|
||||
|
|
|
@ -82,14 +82,14 @@ abstract class TFloatBufferImpl extends TFloatBuffer {
|
|||
if (isReadOnly()) {
|
||||
throw new TReadOnlyBufferException();
|
||||
}
|
||||
int sz = remaining();
|
||||
if (position > 0) {
|
||||
int sz = remaining();
|
||||
int src = position;
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
putElement(i, getElement(src++));
|
||||
}
|
||||
position = sz;
|
||||
}
|
||||
position = sz;
|
||||
limit = capacity;
|
||||
mark = -1;
|
||||
return this;
|
||||
|
|
|
@ -82,14 +82,14 @@ abstract class TIntBufferImpl extends TIntBuffer {
|
|||
if (isReadOnly()) {
|
||||
throw new TReadOnlyBufferException();
|
||||
}
|
||||
int sz = remaining();
|
||||
if (position > 0) {
|
||||
int sz = remaining();
|
||||
int src = position;
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
putElement(i, getElement(src++));
|
||||
}
|
||||
position = sz;
|
||||
}
|
||||
position = sz;
|
||||
limit = capacity;
|
||||
mark = -1;
|
||||
return this;
|
||||
|
|
|
@ -82,14 +82,14 @@ abstract class TLongBufferImpl extends TLongBuffer {
|
|||
if (isReadOnly()) {
|
||||
throw new TReadOnlyBufferException();
|
||||
}
|
||||
int sz = remaining();
|
||||
if (position > 0) {
|
||||
int sz = remaining();
|
||||
int src = position;
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
putElement(i, getElement(src++));
|
||||
}
|
||||
position = sz;
|
||||
}
|
||||
position = sz;
|
||||
limit = capacity;
|
||||
mark = -1;
|
||||
return this;
|
||||
|
|
|
@ -82,14 +82,14 @@ abstract class TShortBufferImpl extends TShortBuffer {
|
|||
if (isReadOnly()) {
|
||||
throw new TReadOnlyBufferException();
|
||||
}
|
||||
int sz = remaining();
|
||||
if (position > 0) {
|
||||
int sz = remaining();
|
||||
int src = position;
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
putElement(i, getElement(src++));
|
||||
}
|
||||
position = sz;
|
||||
}
|
||||
position = sz;
|
||||
limit = capacity;
|
||||
mark = -1;
|
||||
return this;
|
||||
|
|
Loading…
Reference in New Issue
Block a user