8257212: (bf spec) Clarify byte order of the buffer returned by CharBuffer.subsequence(int,int)
Reviewed-by: chegar, bpb, alanb
This commit is contained in:
parent
0ec2c969df
commit
707bce080d
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1835,9 +1835,10 @@ public abstract class $Type$Buffer
|
||||
* content of this buffer is mutable then modifications to one buffer will
|
||||
* cause the other to be modified. The new buffer's capacity will be that
|
||||
* of this buffer, its position will be
|
||||
* {@code position()} + {@code start}, and its limit will be
|
||||
* {@code position()} + {@code end}. The new buffer will be
|
||||
* direct if, and only if, this buffer is direct, and it will be read-only
|
||||
* {@code position()} + {@code start}, its limit will be
|
||||
* {@code position()} + {@code end}, and its byte order
|
||||
* will be identical to that of this buffer. The new buffer will be direct
|
||||
* if, and only if, this buffer is direct, and it will be read-only
|
||||
* if, and only if, this buffer is read-only. </p>
|
||||
*
|
||||
* @param start
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,6 +37,10 @@ public class Order$Type$ extends Order {
|
||||
ck(buf.asReadOnlyBuffer().order(), expected);
|
||||
ck(buf.duplicate().order(), expected);
|
||||
ck(buf.slice().order(), expected);
|
||||
#if[char]
|
||||
ck(buf.subSequence(buf.position(), buf.remaining()).order(), expected);
|
||||
ck(buf.subSequence(buf.position(), buf.position()).order(), expected);
|
||||
#end[char]
|
||||
}
|
||||
|
||||
static void ck$Type$Buffer() {
|
||||
@ -52,5 +56,27 @@ public class Order$Type$ extends Order {
|
||||
buf = $Type$Buffer.allocate(LENGTH);
|
||||
ck(buf.order(), nord);
|
||||
ck$Type$Buffer(buf, nord);
|
||||
#if[char]
|
||||
buf = $Type$Buffer.wrap("abcdefghijk");
|
||||
ck(buf.order(), nord);
|
||||
ck$Type$Buffer(buf, nord);
|
||||
|
||||
buf = $Type$Buffer.wrap("abcdefghijk", 0, 5);
|
||||
ck(buf.order(), nord);
|
||||
ck$Type$Buffer(buf, nord);
|
||||
|
||||
buf = $Type$Buffer.wrap(array).subSequence(0, LENGTH);
|
||||
ck(buf.order(), nord);
|
||||
ck$Type$Buffer(buf, nord);
|
||||
|
||||
buf = ByteBuffer.wrap(new byte[LENGTH]).as$Type$Buffer();
|
||||
ck(buf.order(), be);
|
||||
ck$Type$Buffer(buf, be);
|
||||
|
||||
buf = ByteBuffer.wrap(new byte[LENGTH]).order(le).as$Type$Buffer();
|
||||
ck(buf.order(), le);
|
||||
ck$Type$Buffer(buf, le);
|
||||
#end[char]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,6 +37,10 @@ public class OrderChar extends Order {
|
||||
ck(buf.asReadOnlyBuffer().order(), expected);
|
||||
ck(buf.duplicate().order(), expected);
|
||||
ck(buf.slice().order(), expected);
|
||||
|
||||
ck(buf.subSequence(buf.position(), buf.remaining()).order(), expected);
|
||||
ck(buf.subSequence(buf.position(), buf.position()).order(), expected);
|
||||
|
||||
}
|
||||
|
||||
static void ckCharBuffer() {
|
||||
@ -52,5 +56,27 @@ public class OrderChar extends Order {
|
||||
buf = CharBuffer.allocate(LENGTH);
|
||||
ck(buf.order(), nord);
|
||||
ckCharBuffer(buf, nord);
|
||||
|
||||
buf = CharBuffer.wrap("abcdefghijk");
|
||||
ck(buf.order(), nord);
|
||||
ckCharBuffer(buf, nord);
|
||||
|
||||
buf = CharBuffer.wrap("abcdefghijk", 0, 5);
|
||||
ck(buf.order(), nord);
|
||||
ckCharBuffer(buf, nord);
|
||||
|
||||
buf = CharBuffer.wrap(array).subSequence(0, LENGTH);
|
||||
ck(buf.order(), nord);
|
||||
ckCharBuffer(buf, nord);
|
||||
|
||||
buf = ByteBuffer.wrap(new byte[LENGTH]).asCharBuffer();
|
||||
ck(buf.order(), be);
|
||||
ckCharBuffer(buf, be);
|
||||
|
||||
buf = ByteBuffer.wrap(new byte[LENGTH]).order(le).asCharBuffer();
|
||||
ck(buf.order(), le);
|
||||
ckCharBuffer(buf, le);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,6 +37,10 @@ public class OrderDouble extends Order {
|
||||
ck(buf.asReadOnlyBuffer().order(), expected);
|
||||
ck(buf.duplicate().order(), expected);
|
||||
ck(buf.slice().order(), expected);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void ckDoubleBuffer() {
|
||||
@ -52,5 +56,27 @@ public class OrderDouble extends Order {
|
||||
buf = DoubleBuffer.allocate(LENGTH);
|
||||
ck(buf.order(), nord);
|
||||
ckDoubleBuffer(buf, nord);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,6 +37,10 @@ public class OrderFloat extends Order {
|
||||
ck(buf.asReadOnlyBuffer().order(), expected);
|
||||
ck(buf.duplicate().order(), expected);
|
||||
ck(buf.slice().order(), expected);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void ckFloatBuffer() {
|
||||
@ -52,5 +56,27 @@ public class OrderFloat extends Order {
|
||||
buf = FloatBuffer.allocate(LENGTH);
|
||||
ck(buf.order(), nord);
|
||||
ckFloatBuffer(buf, nord);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,6 +37,10 @@ public class OrderInt extends Order {
|
||||
ck(buf.asReadOnlyBuffer().order(), expected);
|
||||
ck(buf.duplicate().order(), expected);
|
||||
ck(buf.slice().order(), expected);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void ckIntBuffer() {
|
||||
@ -52,5 +56,27 @@ public class OrderInt extends Order {
|
||||
buf = IntBuffer.allocate(LENGTH);
|
||||
ck(buf.order(), nord);
|
||||
ckIntBuffer(buf, nord);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,6 +37,10 @@ public class OrderLong extends Order {
|
||||
ck(buf.asReadOnlyBuffer().order(), expected);
|
||||
ck(buf.duplicate().order(), expected);
|
||||
ck(buf.slice().order(), expected);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void ckLongBuffer() {
|
||||
@ -52,5 +56,27 @@ public class OrderLong extends Order {
|
||||
buf = LongBuffer.allocate(LENGTH);
|
||||
ck(buf.order(), nord);
|
||||
ckLongBuffer(buf, nord);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,6 +37,10 @@ public class OrderShort extends Order {
|
||||
ck(buf.asReadOnlyBuffer().order(), expected);
|
||||
ck(buf.duplicate().order(), expected);
|
||||
ck(buf.slice().order(), expected);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void ckShortBuffer() {
|
||||
@ -52,5 +56,27 @@ public class OrderShort extends Order {
|
||||
buf = ShortBuffer.allocate(LENGTH);
|
||||
ck(buf.order(), nord);
|
||||
ckShortBuffer(buf, nord);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user