--- old/src/java.base/share/classes/java/io/ByteArrayOutputStream.java 2018-03-14 14:41:46.000000000 -0700 +++ new/src/java.base/share/classes/java/io/ByteArrayOutputStream.java 2018-03-14 14:41:46.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -68,8 +68,8 @@ * Creates a new byte array output stream, with a buffer capacity of * the specified size, in bytes. * - * @param size the initial size. - * @exception IllegalArgumentException if size is negative. + * @param size the initial size. + * @throws IllegalArgumentException if size is negative. */ public ByteArrayOutputStream(int size) { if (size < 0) { @@ -84,7 +84,7 @@ * at least the number of elements specified by the minimum * capacity argument. * - * @param minCapacity the desired minimum capacity + * @param minCapacity the desired minimum capacity * @throws OutOfMemoryError if {@code minCapacity < 0}. This is * interpreted as a request for the unsatisfiably large capacity * {@code (long) Integer.MAX_VALUE + (minCapacity - Integer.MAX_VALUE)}. @@ -146,6 +146,10 @@ * @param b the data. * @param off the start offset in the data. * @param len the number of bytes to write. + * @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); @@ -155,12 +159,28 @@ } /** + * Writes the complete contents of the specified byte array + * to this byte array output stream. + * + *

This method is equivalent to {@link #write(byte[],int,int) + * write(b,0,b.length)}. + * + * @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 byte array output stream to * the specified output stream argument, as if by calling the output * stream's write method using {@code out.write(buf, 0, count)}. * - * @param out the output stream to which to write the data. - * @exception IOException if an I/O error occurs. + * @param out the output stream to which to write the data. + * @throws NullPointerException if {@code out} is {@code null}. + * @throws IOException if an I/O error occurs. */ public synchronized void writeTo(OutputStream out) throws IOException { out.write(buf, 0, count); @@ -244,12 +264,12 @@ * * * - * @param charsetName the name of a supported - * {@link java.nio.charset.Charset charset} - * @return String decoded from the buffer's contents. - * @exception UnsupportedEncodingException - * If the named charset is not supported - * @since 1.1 + * @param charsetName the name of a supported + * {@link java.nio.charset.Charset charset} + * @return String decoded from the buffer's contents. + * @throws UnsupportedEncodingException + * If the named charset is not supported + * @since 1.1 */ public synchronized String toString(String charsetName) throws UnsupportedEncodingException