< prev index next >
test/jdk/java/nio/Buffer/ByteBufferViews.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -62,17 +62,21 @@
size -> ByteBuffer.allocate(size).position(8)),
Map.entry("ByteBuffer.allocate(size).position(8).slice()",
size -> ByteBuffer.allocate(size).position(8).slice()),
Map.entry("ByteBuffer.allocate(size).position(8).slice().duplicate()",
size -> ByteBuffer.allocate(size).position(8).slice().duplicate()),
+ Map.entry("ByteBuffer.allocate(size).slice(8,size-8)",
+ size -> ByteBuffer.allocate(size).slice(8,size-8)),
// Unaligned
Map.entry("ByteBuffer.allocate(size).position(1)",
size -> ByteBuffer.allocate(size).position(1)),
Map.entry("ByteBuffer.allocate(size).position(1).slice()",
size -> ByteBuffer.allocate(size).position(1).slice()),
Map.entry("ByteBuffer.allocate(size).position(1).slice().duplicate()",
size -> ByteBuffer.allocate(size).position(1).slice().duplicate()),
+ Map.entry("ByteBuffer.allocate(size).slice(1,size-1)",
+ size -> ByteBuffer.allocate(size).slice(1,size-1)),
// Off-heap
Map.entry("ByteBuffer.allocateDirect(size)",
size -> ByteBuffer.allocateDirect(size)),
// Aligned
@@ -80,17 +84,21 @@
size -> ByteBuffer.allocateDirect(size).position(8)),
Map.entry("ByteBuffer.allocateDirect(size).position(8).slice()",
size -> ByteBuffer.allocateDirect(size).position(8).slice()),
Map.entry("ByteBuffer.allocateDirect(size).position(8).slice().duplicate()",
size -> ByteBuffer.allocateDirect(size).position(8).slice().duplicate()),
+ Map.entry("ByteBuffer.allocateDirect(size).slice(8,size-8)",
+ size -> ByteBuffer.allocateDirect(size).slice(8,size-8)),
// Unaligned
Map.entry("ByteBuffer.allocateDirect(size).position(1)",
size -> ByteBuffer.allocateDirect(size).position(1)),
Map.entry("ByteBuffer.allocateDirect(size).position(1).slice()",
size -> ByteBuffer.allocateDirect(size).position(1).slice()),
Map.entry("ByteBuffer.allocateDirect(size).position(1).slice().duplicate()",
- size -> ByteBuffer.allocateDirect(size).position(1).slice().duplicate())
+ size -> ByteBuffer.allocateDirect(size).position(1).slice().duplicate()),
+ Map.entry("ByteBuffer.allocateDirect(size).slice(1,size-1)",
+ size -> ByteBuffer.allocateDirect(size).slice(1,size-1))
);
// List of buffer byte order functions
static final List<Map.Entry<String, UnaryOperator<ByteBuffer>>> BYTE_BUFFER_ORDER_FUNCTIONS = List.of(
Map.entry("order(ByteOrder.BIG_ENDIAN)",
< prev index next >