mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
5071718: (bf) Add ByteBuffer.slice(int offset, int length)
Reviewed-by: alanb, bchristi, darcy, rriggs
This commit is contained in:
parent
8f84ae5684
commit
fad1f059b0
17 changed files with 367 additions and 77 deletions
|
@ -218,14 +218,17 @@ class Direct$Type$Buffer$RW$$BO$
|
|||
return new Direct$Type$Buffer$RW$$BO$(this, -1, 0, rem, rem, off);
|
||||
}
|
||||
|
||||
#if[byte]
|
||||
public $Type$Buffer slice(int pos, int lim) {
|
||||
assert (pos >= 0);
|
||||
assert (pos <= lim);
|
||||
int rem = lim - pos;
|
||||
return new Direct$Type$Buffer$RW$$BO$(this, -1, 0, rem, rem, pos);
|
||||
@Override
|
||||
public $Type$Buffer slice(int index, int length) {
|
||||
Objects.checkIndex(index, limit() + 1);
|
||||
Objects.checkIndex(length, limit() - index + 1);
|
||||
return new Direct$Type$Buffer$RW$$BO$(this,
|
||||
-1,
|
||||
0,
|
||||
length,
|
||||
length,
|
||||
index);
|
||||
}
|
||||
#end[byte]
|
||||
|
||||
public $Type$Buffer duplicate() {
|
||||
return new Direct$Type$Buffer$RW$$BO$(this,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue