< prev index next >
src/java.base/share/classes/java/io/PrintStream.java
Print this page
@@ -1,7 +1,7 @@
/*
- * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -567,10 +567,32 @@
catch (IOException x) {
trouble = true;
}
}
+ /**
+ * Writes all bytes from the specified byte array to this stream.
+ * If automatic flushing is enabled then the {@code flush} method
+ * will be invoked.
+ *
+ * <p> 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
+ * This method is equivalent to {@link #write(byte[],int,int)
+ * write(b, 0, b.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
* stream occur as promptly as with the original PrintStream.
*/
< prev index next >