--- old/src/java.base/share/classes/java/io/PrintStream.java 2019-07-23 09:35:29.000000000 -0700 +++ new/src/java.base/share/classes/java/io/PrintStream.java 2019-07-23 09:35:28.000000000 -0700 @@ -415,6 +415,7 @@ * * @see java.io.OutputStream#flush() */ + @Override public void flush() { synchronized (this) { try { @@ -435,6 +436,7 @@ * * @see java.io.OutputStream#close() */ + @Override public void close() { synchronized (this) { if (! closing) { @@ -526,6 +528,7 @@ * @see #print(char) * @see #println(char) */ + @Override public void write(int b) { try { synchronized (this) { @@ -557,6 +560,7 @@ * @param off Offset from which to start taking bytes * @param len Number of bytes to write */ + @Override public void write(byte buf[], int off, int len) { try { synchronized (this) { @@ -574,6 +578,61 @@ } } + /** + * Writes all bytes from the specified byte array to this stream. + * The automatic flushing setting is ignored. The internal flag + * tested by {@link #checkError()} will not be set if an + * {@code IOException} is thrown. + * + *

Note that the bytes will be written as given; to write characters + * that will be translated according to the platform's default character + * encoding, use the {@code print(char[])} or {@code println(char[])} + * methods. + * + * @apiNote + * Unlike other overridden methods in this class, this method may throw + * an {@code IOException}. To write an array of bytes without being + * required to handle an {@code IOException}, use either + * {@link #writeBytes(byte[] buf) writeBytes(buf)} or + * {@link #write(byte[],int,int) write(buf,0,buf.length)}. + * + * @implSpec + * The default implementation is equivalent to + * {@link java.io.FilterOutputStream#write(byte[],int,int) + * super.write(buf,0,buf.length)}. + * + * @param buf A byte array + * + * @see #writeBytes(byte[]) + * @see #write(byte[],int,int) + */ + @Override + public void write(byte buf[]) throws IOException { + super.write(buf, 0, buf.length); + } + + /** + * Writes all bytes from the specified byte array to this stream. + * If automatic flushing is enabled then the {@code flush} method + * will be invoked. + * + *

Note that the bytes will be written as given; to write characters + * that will be translated according to the platform's default character + * encoding, use the {@code print(char[])} or {@code println(char[])} + * methods. + * + * @implSpec + * The default implementation is equivalent to + * {@link #write(byte[],int,int) this.write(buf, 0, buf.length)}. + * + * @param buf A byte array + * + * @since 14 + */ + public void writeBytes(byte buf[]) { + this.write(buf, 0, buf.length); + } + /* * The following private methods on the text- and character-output streams * always flush the stream buffers, so that writes to the underlying byte