< prev index next >
src/java.base/share/classes/java/nio/StringCharBuffer.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2000, 2018, 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. Oracle designates this
--- 1,7 ----
/*
! * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 23,32 ****
--- 23,33 ----
* questions.
*/
package java.nio;
+ import java.util.Objects;
// ## If the sequence is a string, use reflection to share its array
class StringCharBuffer // package-private
extends CharBuffer
*** 49,58 ****
--- 50,70 ----
this.remaining(),
this.remaining(),
offset + this.position());
}
+ @Override
+ public CharBuffer slice(int index, int length) {
+ Objects.checkFromIndexSize(index, length, limit());
+ return new StringCharBuffer(str,
+ -1,
+ 0,
+ length,
+ length,
+ offset + index);
+ }
+
private StringCharBuffer(CharSequence s,
int mark,
int pos,
int limit,
int cap,
< prev index next >