< prev index next >

src/java.base/share/classes/java/io/ByteArrayOutputStream.java

Print this page

        

*** 47,57 **** public class ByteArrayOutputStream extends OutputStream { /** * The buffer where data is stored. */ ! protected byte buf[]; /** * The number of valid bytes in the buffer. */ protected int count; --- 47,57 ---- public class ByteArrayOutputStream extends OutputStream { /** * The buffer where data is stored. */ ! protected byte[] buf; /** * The number of valid bytes in the buffer. */ protected int count;
*** 149,159 **** * @throws NullPointerException if {@code b} is {@code null}. * @throws IndexOutOfBoundsException if {@code off} is negative, * {@code len} is negative, or {@code len} is greater than * {@code b.length - off} */ ! public synchronized void write(byte b[], int off, int len) { Objects.checkFromIndexSize(off, len, b.length); ensureCapacity(count + len); System.arraycopy(b, off, buf, count, len); count += len; } --- 149,159 ---- * @throws NullPointerException if {@code b} is {@code null}. * @throws IndexOutOfBoundsException if {@code off} is negative, * {@code len} is negative, or {@code len} is greater than * {@code b.length - off} */ ! public synchronized void write(byte[] b, int off, int len) { Objects.checkFromIndexSize(off, len, b.length); ensureCapacity(count + len); System.arraycopy(b, off, buf, count, len); count += len; }
*** 168,178 **** * * @param b the data. * @throws NullPointerException if {@code b} is {@code null}. * @since 11 */ ! public void writeBytes(byte b[]) { write(b, 0, b.length); } /** * Writes the complete contents of this {@code ByteArrayOutputStream} to --- 168,178 ---- * * @param b the data. * @throws NullPointerException if {@code b} is {@code null}. * @since 11 */ ! public void writeBytes(byte[] b) { write(b, 0, b.length); } /** * Writes the complete contents of this {@code ByteArrayOutputStream} to
< prev index next >