--- a/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template Wed Feb 20 13:24:57 2019 -0500
+++ b/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template Wed Feb 20 10:57:22 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -38,6 +38,8 @@
#end[rw]
*/
+import java.util.Objects;
+
class Heap$Type$Buffer$RW$
extends {#if[ro]?Heap}$Type$Buffer
{
@@ -181,6 +183,13 @@
return this;
}
+ public $Type$Buffer get(int index, $type$[] dst, int offset, int length) {
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, dst.length);
+ System.arraycopy(hb, ix(index), dst, offset, length);
+ return this;
+ }
+
public boolean isDirect() {
return false;
}
@@ -250,6 +259,17 @@
#end[rw]
}
+ public $Type$Buffer put(int index, $type$[] src, int offset, int length) {
+#if[rw]
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, src.length);
+ System.arraycopy(src, offset, hb, ix(index), length);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
public $Type$Buffer compact() {
#if[rw]
System.arraycopy(hb, ix(position()), hb, ix(0), remaining());