mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8266078: Reader.read(CharBuffer) advances Reader position for read-only Charbuffers
Reviewed-by: rriggs, alanb, chegar
This commit is contained in:
parent
2a03739530
commit
5f15666092
2 changed files with 71 additions and 0 deletions
|
@ -27,6 +27,7 @@ package java.io;
|
|||
|
||||
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.ReadOnlyBufferException;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
@ -184,6 +185,9 @@ public abstract class Reader implements Readable, Closeable {
|
|||
* @since 1.5
|
||||
*/
|
||||
public int read(CharBuffer target) throws IOException {
|
||||
if (target.isReadOnly())
|
||||
throw new ReadOnlyBufferException();
|
||||
|
||||
int nread;
|
||||
if (target.hasArray()) {
|
||||
char[] cbuf = target.array();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue