< prev index next >
src/java.base/share/classes/java/io/StringBufferInputStream.java
Print this page
rev 15357 : imported patch 8163517-Various-cleanup-in-java-io-code
*** 106,115 ****
--- 106,116 ----
* @param len the maximum number of bytes read.
* @return the total number of bytes read into the buffer, or
* <code>-1</code> if there is no more data because the end of
* the stream has been reached.
*/
+ @SuppressWarnings("deprecation")
public synchronized int read(byte b[], int off, int len) {
if (b == null) {
throw new NullPointerException();
} else if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
*** 124,139 ****
len = avail;
}
if (len <= 0) {
return 0;
}
! String s = buffer;
! int cnt = len;
! while (--cnt >= 0) {
! b[off++] = (byte)s.charAt(pos++);
! }
!
return len;
}
/**
* Skips <code>n</code> bytes of input from this input stream. Fewer
--- 125,135 ----
len = avail;
}
if (len <= 0) {
return 0;
}
! buffer.getBytes(pos, pos + len, b, off);
return len;
}
/**
* Skips <code>n</code> bytes of input from this input stream. Fewer
< prev index next >