--- old/src/java.base/share/classes/java/io/PrintStream.java 2019-08-13 14:15:49.000000000 -0700 +++ new/src/java.base/share/classes/java/io/PrintStream.java 2019-08-13 14:15:48.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,64 @@ } } + /** + * 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. + * + * @apiNote + * Although declared to throw {@code IOException}, this method never + * actually does so. Instead, like other methods that this class + * overrides, it sets an internal flag which may be tested via the + * {@link #checkError()} method. To write an array of bytes without having + * to write a {@code catch} block for the {@code IOException}, use either + * {@link #writeBytes(byte[] buf) writeBytes(buf)} or + * {@link #write(byte[], int, int) write(buf, 0, buf.length)}. + * + * @implSpec + * This method is equivalent to + * {@link java.io.PrintStream#write(byte[],int,int) + * this.write(buf, 0, buf.length)}. + * + * @param buf A byte array + * + * @throws IOException If an I/O error occurs. + * + * @see #writeBytes(byte[]) + * @see #write(byte[],int,int) + */ + @Override + public void write(byte buf[]) throws IOException { + this.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 + * This method 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