jdk/src/java.base/share/classes/java/io/FilterOutputStream.java
author avstepan
Thu, 06 Aug 2015 13:20:13 +0300
changeset 32033 bf24e33c7919
parent 31421 d6ddd21f6df8
child 43794 497288c158bf
permissions -rw-r--r--
8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math Reviewed-by: lancea, dfuchs, smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
31421
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
     2
 * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.io;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * This class is the superclass of all classes that filter output
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * streams. These streams sit on top of an already existing output
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * stream (the <i>underlying</i> output stream) which it uses as its
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * basic sink of data, but possibly transforming the data along the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * way or providing additional functionality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * The class <code>FilterOutputStream</code> itself simply overrides
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * all methods of <code>OutputStream</code> with versions that pass
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * all requests to the underlying output stream. Subclasses of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <code>FilterOutputStream</code> may further override some of these
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * methods as well as provide additional methods and fields.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * @author  Jonathan Payne
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 10347
diff changeset
    42
 * @since   1.0
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 */
31421
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
    44
public class FilterOutputStream extends OutputStream {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     * The underlying output stream to be filtered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    protected OutputStream out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
31421
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
    50
    /**
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
    51
     * Whether the stream is closed; implicitly initialized to false.
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
    52
     */
28292
140e7e529be6 8054565: FilterOutputStream.close may throw IOException if called twice and underlying flush or close fails
chegar
parents: 25859
diff changeset
    53
    private boolean closed;
140e7e529be6 8054565: FilterOutputStream.close may throw IOException if called twice and underlying flush or close fails
chegar
parents: 25859
diff changeset
    54
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * Creates an output stream filter built on top of the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * underlying output stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * @param   out   the underlying output stream to be assigned to
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 31421
diff changeset
    60
     *                the field {@code this.out} for later use, or
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     *                <code>null</code> if this instance is to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     *                created without an underlying stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public FilterOutputStream(OutputStream out) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        this.out = out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * Writes the specified <code>byte</code> to this output stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * The <code>write</code> method of <code>FilterOutputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * calls the <code>write</code> method of its underlying output stream,
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 31421
diff changeset
    73
     * that is, it performs {@code out.write(b)}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * <p>
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 31421
diff changeset
    75
     * Implements the abstract {@code write} method of {@code OutputStream}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * @param      b   the <code>byte</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * @exception  IOException  if an I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     */
31421
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
    80
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    public void write(int b) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        out.write(b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * Writes <code>b.length</code> bytes to this output stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * The <code>write</code> method of <code>FilterOutputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * calls its <code>write</code> method of three arguments with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * arguments <code>b</code>, <code>0</code>, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * <code>b.length</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * Note that this method does not call the one-argument
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * <code>write</code> method of its underlying stream with the single
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * argument <code>b</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * @param      b   the data to be written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * @exception  IOException  if an I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * @see        java.io.FilterOutputStream#write(byte[], int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     */
31421
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   101
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    public void write(byte b[]) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        write(b, 0, b.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * Writes <code>len</code> bytes from the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * <code>byte</code> array starting at offset <code>off</code> to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * this output stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * The <code>write</code> method of <code>FilterOutputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * calls the <code>write</code> method of one argument on each
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * <code>byte</code> to output.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * Note that this method does not call the <code>write</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * of its underlying input stream with the same arguments. Subclasses
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * of <code>FilterOutputStream</code> should provide a more efficient
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * implementation of this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * @param      b     the data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @param      off   the start offset in the data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * @param      len   the number of bytes to write.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @exception  IOException  if an I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @see        java.io.FilterOutputStream#write(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     */
31421
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   126
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    public void write(byte b[], int off, int len) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        if ((off | len | (b.length - (len + off)) | (off + len)) < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            throw new IndexOutOfBoundsException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        for (int i = 0 ; i < len ; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            write(b[off + i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * Flushes this output stream and forces any buffered output bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * to be written out to the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * The <code>flush</code> method of <code>FilterOutputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * calls the <code>flush</code> method of its underlying output stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * @exception  IOException  if an I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * @see        java.io.FilterOutputStream#out
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     */
31421
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   146
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    public void flush() throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        out.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * Closes this output stream and releases any system resources
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * associated with the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * <p>
28292
140e7e529be6 8054565: FilterOutputStream.close may throw IOException if called twice and underlying flush or close fails
chegar
parents: 25859
diff changeset
   155
     * When not already closed, the {@code close} method of {@code
140e7e529be6 8054565: FilterOutputStream.close may throw IOException if called twice and underlying flush or close fails
chegar
parents: 25859
diff changeset
   156
     * FilterOutputStream} calls its {@code flush} method, and then
140e7e529be6 8054565: FilterOutputStream.close may throw IOException if called twice and underlying flush or close fails
chegar
parents: 25859
diff changeset
   157
     * calls the {@code close} method of its underlying output stream.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * @exception  IOException  if an I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * @see        java.io.FilterOutputStream#flush()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * @see        java.io.FilterOutputStream#out
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     */
31421
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   163
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    public void close() throws IOException {
31421
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   165
        if (closed) {
28292
140e7e529be6 8054565: FilterOutputStream.close may throw IOException if called twice and underlying flush or close fails
chegar
parents: 25859
diff changeset
   166
            return;
31421
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   167
        }
28292
140e7e529be6 8054565: FilterOutputStream.close may throw IOException if called twice and underlying flush or close fails
chegar
parents: 25859
diff changeset
   168
        closed = true;
31421
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   169
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   170
        Throwable flushException = null;
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   171
        try {
10347
1c9efe1ec7d3 7015589: (spec) BufferedWriter.close leaves stream open if close of underlying Writer fails
alanb
parents: 9035
diff changeset
   172
            flush();
31421
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   173
        } catch (Throwable e) {
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   174
            flushException = e;
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   175
            throw e;
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   176
        } finally {
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   177
            if (flushException == null) {
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   178
                out.close();
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   179
            } else {
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   180
                try {
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   181
                    out.close();
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   182
                } catch (Throwable closeException) {
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   183
                   // evaluate possible precedence of flushException over closeException
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   184
                   if ((flushException instanceof ThreadDeath) &&
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   185
                       !(closeException instanceof ThreadDeath)) {
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   186
                       flushException.addSuppressed(closeException);
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   187
                       throw (ThreadDeath) flushException;
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   188
                   }
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   189
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   190
                    if (flushException != closeException) {
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   191
                        closeException.addSuppressed(flushException);
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   192
                    }
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   193
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   194
                    throw closeException;
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   195
                }
d6ddd21f6df8 8042377: BufferedWriter and FilteredOutputStream.close throw IAE if flush and close throw equal exceptions
bpb
parents: 28292
diff changeset
   196
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
}