src/java.base/share/classes/javax/crypto/CipherOutputStream.java
author apetcher
Tue, 30 Oct 2018 13:48:19 -0400
changeset 52330 df10a0cacf3e
parent 51759 ac6e9a2ebc04
permissions -rw-r--r--
8205476: KeyAgreement#generateSecret is not reset for ECDH based algorithm Summary: Clarify spec of generateSecret and modify ECDH in SunEC to conform to spec Reviewed-by: mullan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
51759
ac6e9a2ebc04 8210786: Typo s/overriden/overridden/ in several places
igerasim
parents: 49781
diff changeset
     2
 * Copyright (c) 1997, 2018, 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 javax.crypto;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * A CipherOutputStream is composed of an OutputStream and a Cipher so
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * that write() methods first process the data before writing them out
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * to the underlying OutputStream.  The cipher must be fully
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * initialized before being used by a CipherOutputStream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * <p> For example, if the cipher is initialized for encryption, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * CipherOutputStream will attempt to encrypt data before writing out the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * encrypted data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <p> This class adheres strictly to the semantics, especially the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * failure semantics, of its ancestor classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * java.io.OutputStream and java.io.FilterOutputStream.  This class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * has exactly those methods specified in its ancestor classes, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * overrides them all.  Moreover, this class catches all exceptions
49781
21fa027e2e62 8182362: Update CipherOutputStream Usage
apetcher
parents: 47216
diff changeset
    45
 * that are not thrown by its ancestor classes. In particular, this
21fa027e2e62 8182362: Update CipherOutputStream Usage
apetcher
parents: 47216
diff changeset
    46
 * class catches BadPaddingException and other exceptions thrown by
21fa027e2e62 8182362: Update CipherOutputStream Usage
apetcher
parents: 47216
diff changeset
    47
 * failed integrity checks during decryption. These exceptions are not
21fa027e2e62 8182362: Update CipherOutputStream Usage
apetcher
parents: 47216
diff changeset
    48
 * re-thrown, so the client will not be informed that integrity checks
21fa027e2e62 8182362: Update CipherOutputStream Usage
apetcher
parents: 47216
diff changeset
    49
 * failed. Because of this behavior, this class may not be suitable
21fa027e2e62 8182362: Update CipherOutputStream Usage
apetcher
parents: 47216
diff changeset
    50
 * for use with decryption in an authenticated mode of operation (e.g. GCM)
21fa027e2e62 8182362: Update CipherOutputStream Usage
apetcher
parents: 47216
diff changeset
    51
 * if the application requires explicit notification when authentication
21fa027e2e62 8182362: Update CipherOutputStream Usage
apetcher
parents: 47216
diff changeset
    52
 * fails. Such an application can use the Cipher API directly as an
21fa027e2e62 8182362: Update CipherOutputStream Usage
apetcher
parents: 47216
diff changeset
    53
 * alternative to using this class.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <p> It is crucial for a programmer using this class not to use
51759
ac6e9a2ebc04 8210786: Typo s/overriden/overridden/ in several places
igerasim
parents: 49781
diff changeset
    56
 * methods that are not defined or overridden in this class (such as a
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * new method or constructor that is later added to one of the super
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * classes), because the design and implementation of those methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * are unlikely to have considered security impact with regard to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * CipherOutputStream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * @author  Li Gong
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * @see     java.io.OutputStream
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * @see     java.io.FilterOutputStream
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * @see     javax.crypto.Cipher
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * @see     javax.crypto.CipherInputStream
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
public class CipherOutputStream extends FilterOutputStream {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    // the cipher engine to use to process stream data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    private Cipher cipher;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    // the underlying output stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    private OutputStream output;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    /* the buffer holding one byte of incoming data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    private byte[] ibuffer = new byte[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    // the buffer holding data ready to be written out
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    private byte[] obuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
17917
9bd1b39cdbcf 7160837: DigestOutputStream does not turn off digest calculation when "close()" is called
ascarpino
parents: 5506
diff changeset
    85
    // stream status
9bd1b39cdbcf 7160837: DigestOutputStream does not turn off digest calculation when "close()" is called
ascarpino
parents: 5506
diff changeset
    86
    private boolean closed = false;
9bd1b39cdbcf 7160837: DigestOutputStream does not turn off digest calculation when "close()" is called
ascarpino
parents: 5506
diff changeset
    87
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * Constructs a CipherOutputStream from an OutputStream and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * Cipher.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * <br>Note: if the specified output stream or cipher is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * null, a NullPointerException may be thrown later when
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * they are used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * @param os  the OutputStream object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * @param c   an initialized Cipher object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    public CipherOutputStream(OutputStream os, Cipher c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        super(os);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        output = os;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        cipher = c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * Constructs a CipherOutputStream from an OutputStream without
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * specifying a Cipher. This has the effect of constructing a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * CipherOutputStream using a NullCipher.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * <br>Note: if the specified output stream is null, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * NullPointerException may be thrown later when it is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * @param os  the OutputStream object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    protected CipherOutputStream(OutputStream os) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        super(os);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        output = os;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        cipher = new NullCipher();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * Writes the specified byte to this output stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @param      b   the <code>byte</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @exception  IOException  if an I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    public void write(int b) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        ibuffer[0] = (byte) b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        obuffer = cipher.update(ibuffer, 0, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        if (obuffer != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            output.write(obuffer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            obuffer = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        }
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
     * Writes <code>b.length</code> bytes from the specified byte array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * to this output stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * The <code>write</code> method of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * <code>CipherOutputStream</code> calls the <code>write</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * method of three arguments with the three arguments
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * <code>b</code>, <code>0</code>, and <code>b.length</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * @param      b   the data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * @exception  NullPointerException if <code>b</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * @exception  IOException  if an I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * @see        javax.crypto.CipherOutputStream#write(byte[], int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    public void write(byte b[]) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        write(b, 0, b.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * Writes <code>len</code> bytes from the specified byte array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * starting at offset <code>off</code> to this output stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * @param      b     the data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * @param      off   the start offset in the data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * @param      len   the number of bytes to write.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * @exception  IOException  if an I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    public void write(byte b[], int off, int len) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        obuffer = cipher.update(b, off, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        if (obuffer != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            output.write(obuffer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            obuffer = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * Flushes this output stream by forcing any buffered output bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * that have already been processed by the encapsulated cipher object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * to be written out.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * <p>Any bytes buffered by the encapsulated cipher
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * and waiting to be processed by it will not be written out. For example,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * if the encapsulated cipher is a block cipher, and the total number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * bytes written using one of the <code>write</code> methods is less than
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * the cipher's block size, no bytes will be written out.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * @exception  IOException  if an I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    public void flush() throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        if (obuffer != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            output.write(obuffer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            obuffer = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        output.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * Closes this output stream and releases any system resources
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * associated with this stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * This method invokes the <code>doFinal</code> method of the encapsulated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * cipher object, which causes any bytes buffered by the encapsulated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * cipher to be processed. The result is written out by calling the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * <code>flush</code> method of this output stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * This method resets the encapsulated cipher object to its initial state
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * and calls the <code>close</code> method of the underlying output
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * @exception  IOException  if an I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    public void close() throws IOException {
17917
9bd1b39cdbcf 7160837: DigestOutputStream does not turn off digest calculation when "close()" is called
ascarpino
parents: 5506
diff changeset
   207
        if (closed) {
9bd1b39cdbcf 7160837: DigestOutputStream does not turn off digest calculation when "close()" is called
ascarpino
parents: 5506
diff changeset
   208
            return;
9bd1b39cdbcf 7160837: DigestOutputStream does not turn off digest calculation when "close()" is called
ascarpino
parents: 5506
diff changeset
   209
        }
9bd1b39cdbcf 7160837: DigestOutputStream does not turn off digest calculation when "close()" is called
ascarpino
parents: 5506
diff changeset
   210
9bd1b39cdbcf 7160837: DigestOutputStream does not turn off digest calculation when "close()" is called
ascarpino
parents: 5506
diff changeset
   211
        closed = true;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            obuffer = cipher.doFinal();
17917
9bd1b39cdbcf 7160837: DigestOutputStream does not turn off digest calculation when "close()" is called
ascarpino
parents: 5506
diff changeset
   214
        } catch (IllegalBlockSizeException | BadPaddingException e) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            obuffer = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        } catch (IOException ignored) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        out.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
}