@@ -415,6 +415,7 @@ private void ensureOpen() throws IOException {
415
415
*
416
416
* @see java.io.OutputStream#flush()
417
417
*/
418
+ @ Override
418
419
public void flush () {
419
420
synchronized (this ) {
420
421
try {
@@ -435,6 +436,7 @@ public void flush() {
435
436
*
436
437
* @see java.io.OutputStream#close()
437
438
*/
439
+ @ Override
438
440
public void close () {
439
441
synchronized (this ) {
440
442
if (! closing ) {
@@ -526,6 +528,7 @@ protected void clearError() {
526
528
* @see #print(char)
527
529
* @see #println(char)
528
530
*/
531
+ @ Override
529
532
public void write (int b ) {
530
533
try {
531
534
synchronized (this ) {
@@ -557,6 +560,7 @@ public void write(int b) {
557
560
* @param off Offset from which to start taking bytes
558
561
* @param len Number of bytes to write
559
562
*/
563
+ @ Override
560
564
public void write (byte buf [], int off , int len ) {
561
565
try {
562
566
synchronized (this ) {
@@ -574,6 +578,66 @@ public void write(byte buf[], int off, int len) {
574
578
}
575
579
}
576
580
581
+ /**
582
+ * Writes all bytes from the specified byte array to this stream. If
583
+ * automatic flushing is enabled then the {@code flush} method will be
584
+ * invoked.
585
+ *
586
+ * <p> Note that the bytes will be written as given; to write characters
587
+ * that will be translated according to the platform's default character
588
+ * encoding, use the {@code print(char[])} or {@code println(char[])}
589
+ * methods.
590
+ *
591
+ * @apiNote
592
+ * Although declared to throw {@code IOException}, this method never
593
+ * actually does so. Instead, like other methods that this class
594
+ * overrides, it sets an internal flag which may be tested via the
595
+ * {@link #checkError()} method. To write an array of bytes without having
596
+ * to write a {@code catch} block for the {@code IOException}, use either
597
+ * {@link #writeBytes(byte[] buf) writeBytes(buf)} or
598
+ * {@link #write(byte[], int, int) write(buf, 0, buf.length)}.
599
+ *
600
+ * @implSpec
601
+ * This method is equivalent to
602
+ * {@link java.io.PrintStream#write(byte[],int,int)
603
+ * this.write(buf, 0, buf.length)}.
604
+ *
605
+ * @param buf A byte array
606
+ *
607
+ * @throws IOException If an I/O error occurs.
608
+ *
609
+ * @see #writeBytes(byte[])
610
+ * @see #write(byte[],int,int)
611
+ *
612
+ * @since 14
613
+ */
614
+ @ Override
615
+ public void write (byte buf []) throws IOException {
616
+ this .write (buf , 0 , buf .length );
617
+ }
618
+
619
+ /**
620
+ * Writes all bytes from the specified byte array to this stream.
621
+ * If automatic flushing is enabled then the {@code flush} method
622
+ * will be invoked.
623
+ *
624
+ * <p> Note that the bytes will be written as given; to write characters
625
+ * that will be translated according to the platform's default character
626
+ * encoding, use the {@code print(char[])} or {@code println(char[])}
627
+ * methods.
628
+ *
629
+ * @implSpec
630
+ * This method is equivalent to
631
+ * {@link #write(byte[], int, int) this.write(buf, 0, buf.length)}.
632
+ *
633
+ * @param buf A byte array
634
+ *
635
+ * @since 14
636
+ */
637
+ public void writeBytes (byte buf []) {
638
+ this .write (buf , 0 , buf .length );
639
+ }
640
+
577
641
/*
578
642
* The following private methods on the text- and character-output streams
579
643
* always flush the stream buffers, so that writes to the underlying byte
0 commit comments