8234841: Enhance buffering of byte buffers
Reviewed-by: alanb, ahgross, rhalade, psandoz
This commit is contained in:
parent
f476138133
commit
f711ce40ba
@ -80,7 +80,6 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
|
||||
public $Type$Buffer slice() {
|
||||
int pos = this.position();
|
||||
int lim = this.limit();
|
||||
assert (pos <= lim);
|
||||
int rem = (pos <= lim ? lim - pos : 0);
|
||||
long addr = byteOffset(pos);
|
||||
return new ByteBufferAs$Type$Buffer$RW$$BO$(bb, -1, 0, rem, rem, addr, segment);
|
||||
|
@ -213,7 +213,6 @@ class Direct$Type$Buffer$RW$$BO$
|
||||
public $Type$Buffer slice() {
|
||||
int pos = this.position();
|
||||
int lim = this.limit();
|
||||
assert (pos <= lim);
|
||||
int rem = (pos <= lim ? lim - pos : 0);
|
||||
int off = (pos << $LG_BYTES_PER_VALUE$);
|
||||
assert (off >= 0);
|
||||
|
@ -105,13 +105,15 @@ class Heap$Type$Buffer$RW$
|
||||
}
|
||||
|
||||
public $Type$Buffer slice() {
|
||||
int rem = this.remaining();
|
||||
int pos = this.position();
|
||||
int lim = this.limit();
|
||||
int rem = (pos <= lim ? lim - pos : 0);
|
||||
return new Heap$Type$Buffer$RW$(hb,
|
||||
-1,
|
||||
0,
|
||||
rem,
|
||||
rem,
|
||||
this.position() + offset, segment);
|
||||
pos + offset, segment);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,12 +43,15 @@ class StringCharBuffer // package-private
|
||||
}
|
||||
|
||||
public CharBuffer slice() {
|
||||
int pos = this.position();
|
||||
int lim = this.limit();
|
||||
int rem = (pos <= lim ? lim - pos : 0);
|
||||
return new StringCharBuffer(str,
|
||||
-1,
|
||||
0,
|
||||
this.remaining(),
|
||||
this.remaining(),
|
||||
offset + this.position());
|
||||
rem,
|
||||
rem,
|
||||
offset + pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user