src/jdk.rmic/share/classes/sun/rmi/rmic/IndentingWriter.java
author shade
Fri, 11 May 2018 17:37:14 +0200
changeset 50084 44b64fc0baa3
parent 47216 71c04702a3d5
permissions -rw-r--r--
8202974: Backout JDK-8202683 Reviewed-by: stuefe, erikj
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1997, 2007, 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
/*****************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
/*                    Copyright (c) IBM Corporation 1998                     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/*                                                                           */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/* (C) Copyright IBM Corp. 1998                                              */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/*                                                                           */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/*****************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
package sun.rmi.rmic;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.io.Writer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.io.BufferedWriter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * IndentingWriter is a BufferedWriter subclass that supports automatic
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * indentation of lines of text written to the underlying Writer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * Methods are provided for compact, convenient indenting, writing text,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * and writing lines in various combinations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * WARNING: The contents of this source file are not part of any
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * supported API.  Code that depends on them does so at its own risk:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * they are subject to change or removal without notice.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
public class IndentingWriter extends BufferedWriter {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    /** true if the next character written is the first on a line */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    private boolean beginningOfLine = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    /** current number of spaces to prepend to lines */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    private int currentIndent = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    /** number of spaces to change indent when indenting in or out */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    private int indentStep = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    /** number of spaces to convert into tabs. Use MAX_VALUE to disable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    private int tabSize = 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * Create a new IndentingWriter that writes indented text to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * given Writer.  Use the default indent step of four spaces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    public IndentingWriter(Writer out) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        super(out);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * Create a new IndentingWriter that writes indented text to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * given Writer and uses the supplied indent step.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    public IndentingWriter(Writer out, int step) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        this(out);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        if (indentStep < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            throw new IllegalArgumentException("negative indent step");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        indentStep = step;
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
     * Create a new IndentingWriter that writes indented text to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * given Writer and uses the supplied indent step and tab size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    public IndentingWriter(Writer out, int step, int tabSize) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        this(out);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        if (indentStep < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
            throw new IllegalArgumentException("negative indent step");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        indentStep = step;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        this.tabSize = tabSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * Write a single character.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    public void write(int c) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        checkWrite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        super.write(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * Write a portion of an array of characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    public void write(char[] cbuf, int off, int len) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        if (len > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            checkWrite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        super.write(cbuf, off, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * Write a portion of a String.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    public void write(String s, int off, int len) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        if (len > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            checkWrite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        super.write(s, off, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * Write a line separator.  The next character written will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * preceded by an indent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    public void newLine() throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        super.newLine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        beginningOfLine = true;
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
     * Check if an indent needs to be written before writing the next
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * character.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * The indent generation is optimized (and made consistent with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * certain coding conventions) by condensing groups of eight spaces
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * into tab characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    protected void checkWrite() throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        if (beginningOfLine) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            beginningOfLine = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            int i = currentIndent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            while (i >= tabSize) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                super.write('\t');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                i -= tabSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            while (i > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                super.write(' ');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                -- i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * Increase the current indent by the indent step.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    protected void indentIn() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        currentIndent += indentStep;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * Decrease the current indent by the indent step.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    protected void indentOut() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        currentIndent -= indentStep;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        if (currentIndent < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            currentIndent = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * Indent in.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    public void pI() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        indentIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * Indent out.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    public void pO() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        indentOut();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * Write string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    public void p(String s) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        write(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * End current line.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    public void pln() throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        newLine();
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
     * Write string; end current line.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    public void pln(String s) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        p(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        pln();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * Write string; end current line; indent in.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    public void plnI(String s) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        p(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        pln();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        pI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * Indent out; write string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    public void pO(String s) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        pO();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        p(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * Indent out; write string; end current line.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    public void pOln(String s) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        pO(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        pln();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * Indent out; write string; end current line; indent in.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * This method is useful for generating lines of code that both
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * end and begin nested blocks, like "} else {".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    public void pOlnI(String s) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        pO(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        pln();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        pI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * Write Object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    public void p(Object o) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        write(o.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * Write Object; end current line.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    public void pln(Object o) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        p(o.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        pln();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * Write Object; end current line; indent in.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    public void plnI(Object o) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        p(o.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        pln();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        pI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * Indent out; write Object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    public void pO(Object o) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        pO();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        p(o.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * Indent out; write Object; end current line.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    public void pOln(Object o) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        pO(o.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        pln();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * Indent out; write Object; end current line; indent in.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * This method is useful for generating lines of code that both
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * end and begin nested blocks, like "} else {".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    public void pOlnI(Object o) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        pO(o.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        pln();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        pI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
}