--- old/src/java.base/share/classes/java/io/PrintStream.java 2019-07-12 12:52:19.000000000 -0700 +++ new/src/java.base/share/classes/java/io/PrintStream.java 2019-07-12 12:52:19.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2019, 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 @@ -410,6 +410,7 @@ * * @see java.io.OutputStream#flush() */ + @Override public void flush() { synchronized (this) { try { @@ -430,6 +431,7 @@ * * @see java.io.OutputStream#close() */ + @Override public void close() { synchronized (this) { if (! closing) { @@ -521,6 +523,7 @@ * @see #print(char) * @see #println(char) */ + @Override public void write(int b) { try { synchronized (this) { @@ -545,13 +548,14 @@ * *

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)} + * encoding, use the {@code print(char[])} or {@code println(char[])} * methods. * * @param buf A byte array * @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) { @@ -569,6 +573,36 @@ } } + /** + * 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. + * + * @param buf A byte array + */ + @Override + public void write(byte buf[]) { + try { + synchronized (this) { + ensureOpen(); + out.write(buf, 0, buf.length); + if (autoFlush) + out.flush(); + } + } + catch (InterruptedIOException x) { + Thread.currentThread().interrupt(); + } + catch (IOException x) { + trouble = true; + } + } + /* * The following private methods on the text- and character-output streams * always flush the stream buffers, so that writes to the underlying byte