src/jdk/nashorn/internal/objects/NativeArrayBuffer.java
Print this page
*** 23,32 ****
--- 23,33 ----
* questions.
*/
package jdk.nashorn.internal.objects;
+ import java.nio.ByteBuffer;
import java.util.Arrays;
import jdk.nashorn.internal.objects.annotations.Attribute;
import jdk.nashorn.internal.objects.annotations.Constructor;
import jdk.nashorn.internal.objects.annotations.Function;
import jdk.nashorn.internal.objects.annotations.Getter;
*** 126,131 ****
--- 127,144 ----
}
public int getByteLength() {
return buffer.length;
}
+
+ ByteBuffer getBuffer() {
+ return ByteBuffer.wrap(buffer);
+ }
+
+ ByteBuffer getBuffer(final int offset) {
+ return ByteBuffer.wrap(buffer, offset, buffer.length - offset);
+ }
+
+ ByteBuffer getBuffer(final int offset, final int length) {
+ return ByteBuffer.wrap(buffer, offset, length);
+ }
}