src/java.base/share/classes/java/io/Writer.java
author rriggs
Mon, 19 Mar 2018 09:58:41 -0400
changeset 49262 1b3ee04e3e54
parent 47216 71c04702a3d5
permissions -rw-r--r--
8196298: Add null Reader and Writer Reviewed-by: bpb, forax, smarks, alanb, rriggs Contributed-by: patrick@reini.net
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
49262
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
     2
 * Copyright (c) 1996, 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 java.io;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
49262
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    29
import java.util.Objects;
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    30
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * Abstract class for writing to character streams.  The only methods that a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * subclass must implement are write(char[], int, int), flush(), and close().
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * Most subclasses, however, will override some of the methods defined here in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * order to provide higher efficiency, additional functionality, or both.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * @see   BufferedWriter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * @see   CharArrayWriter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * @see   FilterWriter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * @see   OutputStreamWriter
38373
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
    41
 * @see   FileWriter
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * @see   PipedWriter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * @see   PrintWriter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * @see   StringWriter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * @see Reader
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @author      Mark Reinhold
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 14342
diff changeset
    48
 * @since       1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
public abstract class Writer implements Appendable, Closeable, Flushable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * Temporary buffer used to hold writes of strings and single characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    private char[] writeBuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * Size of writeBuffer, must be >= 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     */
11016
e2665f4ac6d2 7110111: Minor Java SE javadoc & Constructor clean up
lancea
parents: 5506
diff changeset
    61
    private static final int WRITE_BUFFER_SIZE = 1024;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    /**
49262
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    64
     * Returns a new {@code Writer} which discards all characters.  The
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    65
     * returned stream is initially open.  The stream is closed by calling
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    66
     * the {@code close()} method.  Subsequent calls to {@code close()} have
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    67
     * no effect.
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    68
     *
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    69
     * <p> While the stream is open, the {@code append(char)}, {@code
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    70
     * append(CharSequence)}, {@code append(CharSequence, int, int)},
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    71
     * {@code flush()}, {@code write(int)}, {@code write(char[])}, and
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    72
     * {@code write(char[], int, int)} methods do nothing. After the stream
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    73
     * has been closed, these methods all throw {@code IOException}.
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    74
     *
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    75
     * <p> The {@link #lock object} used to synchronize operations on the
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    76
     * returned {@code Writer} is not specified.
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    77
     *
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    78
     * @return a {@code Writer} which discards all characters
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    79
     *
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    80
     * @since 11
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    81
     */
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    82
    public static Writer nullWriter() {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    83
        return new Writer() {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    84
            private volatile boolean closed;
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    85
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    86
            private void ensureOpen() throws IOException {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    87
                if (closed) {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    88
                    throw new IOException("Stream closed");
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    89
                }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    90
            }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    91
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    92
            @Override
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    93
            public Writer append(char c) throws IOException {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    94
                ensureOpen();
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    95
                return this;
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    96
            }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    97
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    98
            @Override
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
    99
            public Writer append(CharSequence csq) throws IOException {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   100
                ensureOpen();
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   101
                return this;
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   102
            }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   103
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   104
            @Override
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   105
            public Writer append(CharSequence csq, int start, int end) throws IOException {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   106
                ensureOpen();
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   107
                if (csq != null) {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   108
                    Objects.checkFromToIndex(start, end, csq.length());
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   109
                }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   110
                return this;
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   111
            }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   112
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   113
            @Override
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   114
            public void write(int c) throws IOException {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   115
                ensureOpen();
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   116
            }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   117
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   118
            @Override
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   119
            public void write(char[] cbuf, int off, int len) throws IOException {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   120
                Objects.checkFromIndexSize(off, len, cbuf.length);
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   121
                ensureOpen();
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   122
            }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   123
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   124
            @Override
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   125
            public void write(String str) throws IOException {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   126
                Objects.requireNonNull(str);
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   127
                ensureOpen();
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   128
            }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   129
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   130
            @Override
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   131
            public void write(String str, int off, int len) throws IOException {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   132
                Objects.checkFromIndexSize(off, len, str.length());
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   133
                ensureOpen();
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   134
            }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   135
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   136
            @Override
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   137
            public void flush() throws IOException {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   138
                ensureOpen();
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   139
            }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   140
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   141
            @Override
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   142
            public void close() throws IOException {
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   143
                closed = true;
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   144
            }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   145
        };
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   146
    }
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   147
1b3ee04e3e54 8196298: Add null Reader and Writer
rriggs
parents: 47216
diff changeset
   148
    /**
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * The object used to synchronize operations on this stream.  For
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * efficiency, a character-stream object may use an object other than
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * itself to protect critical sections.  A subclass should therefore use
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   152
     * the object in this field rather than {@code this} or a synchronized
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    protected Object lock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * Creates a new character-stream writer whose critical sections will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * synchronize on the writer itself.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    protected Writer() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        this.lock = this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * Creates a new character-stream writer whose critical sections will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * synchronize on the given object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @param  lock
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     *         Object to synchronize on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    protected Writer(Object lock) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        if (lock == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            throw new NullPointerException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        this.lock = lock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * Writes a single character.  The character to be written is contained in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * the 16 low-order bits of the given integer value; the 16 high-order bits
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * are ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * <p> Subclasses that intend to support efficient single-character output
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * should override this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * @param  c
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     *         int specifying a character to be written
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * @throws  IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *          If an I/O error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    public void write(int c) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        synchronized (lock) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            if (writeBuffer == null){
11016
e2665f4ac6d2 7110111: Minor Java SE javadoc & Constructor clean up
lancea
parents: 5506
diff changeset
   196
                writeBuffer = new char[WRITE_BUFFER_SIZE];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            writeBuffer[0] = (char) c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            write(writeBuffer, 0, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * Writes an array of characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * @param  cbuf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     *         Array of characters to be written
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * @throws  IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     *          If an I/O error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    public void write(char cbuf[]) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        write(cbuf, 0, cbuf.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * Writes a portion of an array of characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * @param  cbuf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     *         Array of characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * @param  off
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     *         Offset from which to start writing characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * @param  len
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     *         Number of characters to write
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     *
38373
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   228
     * @throws  IndexOutOfBoundsException
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   229
     *          Implementations should throw this exception
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   230
     *          if {@code off} is negative, or {@code len} is negative,
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   231
     *          or {@code off + len} is negative or greater than the length
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   232
     *          of the given array
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   233
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * @throws  IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     *          If an I/O error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     */
32649
2ee9017c7597 8136583: Core libraries should use blessed modifier order
martin
parents: 32033
diff changeset
   237
    public abstract void write(char cbuf[], int off, int len) throws IOException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * Writes a string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * @param  str
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *         String to be written
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * @throws  IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     *          If an I/O error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    public void write(String str) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        write(str, 0, str.length());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * Writes a portion of a string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     *
38373
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   255
     * @implSpec
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   256
     * The implementation in this class throws an
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   257
     * {@code IndexOutOfBoundsException} for the indicated conditions;
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   258
     * overriding methods may choose to do otherwise.
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   259
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * @param  str
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     *         A String
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * @param  off
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     *         Offset from which to start writing characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * @param  len
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     *         Number of characters to write
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * @throws  IndexOutOfBoundsException
38373
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   270
     *          Implementations should throw this exception
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   271
     *          if {@code off} is negative, or {@code len} is negative,
21f4f5eee7cc 8130679: Writer/StringWriter.write methods do not specify index out bounds
bpb
parents: 32649
diff changeset
   272
     *          or {@code off + len} is negative or greater than the length
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     *          of the given string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * @throws  IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     *          If an I/O error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    public void write(String str, int off, int len) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        synchronized (lock) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
            char cbuf[];
11016
e2665f4ac6d2 7110111: Minor Java SE javadoc & Constructor clean up
lancea
parents: 5506
diff changeset
   281
            if (len <= WRITE_BUFFER_SIZE) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
                if (writeBuffer == null) {
11016
e2665f4ac6d2 7110111: Minor Java SE javadoc & Constructor clean up
lancea
parents: 5506
diff changeset
   283
                    writeBuffer = new char[WRITE_BUFFER_SIZE];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
                cbuf = writeBuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
            } else {    // Don't permanently allocate very large buffers.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                cbuf = new char[len];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            str.getChars(off, (off + len), cbuf, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            write(cbuf, 0, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * Appends the specified character sequence to this writer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     *
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   297
     * <p> An invocation of this method of the form {@code out.append(csq)}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * behaves in exactly the same way as the invocation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     *     out.write(csq.toString()) </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     *
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   303
     * <p> Depending on the specification of {@code toString} for the
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   304
     * character sequence {@code csq}, the entire sequence may not be
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   305
     * appended. For instance, invoking the {@code toString} method of a
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * character buffer will return a subsequence whose content depends upon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * the buffer's position and limit.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * @param  csq
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   310
     *         The character sequence to append.  If {@code csq} is
40410
5fd4a1f809f8 8163517: Various cleanup in java.io code
igerasim
parents: 38373
diff changeset
   311
     *         {@code null}, then the four characters {@code "null"} are
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     *         appended to this writer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * @return  This writer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * @throws  IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     *          If an I/O error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * @since  1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    public Writer append(CharSequence csq) throws IOException {
40410
5fd4a1f809f8 8163517: Various cleanup in java.io code
igerasim
parents: 38373
diff changeset
   322
        write(String.valueOf(csq));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * Appends a subsequence of the specified character sequence to this writer.
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   328
     * {@code Appendable}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     *
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   330
     * <p> An invocation of this method of the form
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   331
     * {@code out.append(csq, start, end)} when {@code csq}
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   332
     * is not {@code null} behaves in exactly the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * same way as the invocation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     *
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   335
     * <pre>{@code
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   336
     *     out.write(csq.subSequence(start, end).toString())
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   337
     * }</pre>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * @param  csq
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     *         The character sequence from which a subsequence will be
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   341
     *         appended.  If {@code csq} is {@code null}, then characters
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   342
     *         will be appended as if {@code csq} contained the four
40410
5fd4a1f809f8 8163517: Various cleanup in java.io code
igerasim
parents: 38373
diff changeset
   343
     *         characters {@code "null"}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * @param  start
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     *         The index of the first character in the subsequence
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * @param  end
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     *         The index of the character following the last character in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     *         subsequence
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * @return  This writer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * @throws  IndexOutOfBoundsException
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   355
     *          If {@code start} or {@code end} are negative, {@code start}
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   356
     *          is greater than {@code end}, or {@code end} is greater than
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   357
     *          {@code csq.length()}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * @throws  IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     *          If an I/O error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * @since  1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    public Writer append(CharSequence csq, int start, int end) throws IOException {
40410
5fd4a1f809f8 8163517: Various cleanup in java.io code
igerasim
parents: 38373
diff changeset
   365
        if (csq == null) csq = "null";
5fd4a1f809f8 8163517: Various cleanup in java.io code
igerasim
parents: 38373
diff changeset
   366
        return append(csq.subSequence(start, end));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * Appends the specified character to this writer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     *
32033
bf24e33c7919 8132468: docs: replace <tt> tags (obsolete in html5) for java.io, java.lang, java.math
avstepan
parents: 25859
diff changeset
   372
     * <p> An invocation of this method of the form {@code out.append(c)}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * behaves in exactly the same way as the invocation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     *     out.write(c) </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * @param  c
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     *         The 16-bit character to append
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * @return  This writer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * @throws  IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     *          If an I/O error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    public Writer append(char c) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        write(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * Flushes the stream.  If the stream has saved any characters from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * various write() methods in a buffer, write them immediately to their
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * intended destination.  Then, if that destination is another character or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * byte stream, flush it.  Thus one flush() invocation will flush all the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * buffers in a chain of Writers and OutputStreams.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * <p> If the intended destination of this stream is an abstraction provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * by the underlying operating system, for example a file, then flushing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * stream guarantees only that bytes previously written to the stream are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * passed to the operating system for writing; it does not guarantee that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * they are actually written to a physical device such as a disk drive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * @throws  IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     *          If an I/O error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     */
32649
2ee9017c7597 8136583: Core libraries should use blessed modifier order
martin
parents: 32033
diff changeset
   409
    public abstract void flush() throws IOException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * Closes the stream, flushing it first. Once the stream has been closed,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * further write() or flush() invocations will cause an IOException to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * thrown. Closing a previously closed stream has no effect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * @throws  IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     *          If an I/O error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     */
32649
2ee9017c7597 8136583: Core libraries should use blessed modifier order
martin
parents: 32033
diff changeset
   419
    public abstract void close() throws IOException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
}