Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Constructor and description |
---|
IndentPrinter
() Creates an IndentPrinter backed by a PrintWriter pointing to System.out, with an indent of two spaces. |
IndentPrinter
(Writer out) Creates an IndentPrinter backed by the supplied Writer, with an indent of two spaces. |
IndentPrinter
(Writer out, String indent) Creates an IndentPrinter backed by the supplied Writer, with a user-supplied String to be used for indenting. |
IndentPrinter
(Writer out, String indent, boolean addNewlines) Creates an IndentPrinter backed by the supplied Writer, with a user-supplied String to be used for indenting and the ability to override newline handling. |
IndentPrinter
(Writer out, String indent, boolean addNewlines, boolean autoIndent) Create an IndentPrinter to the given PrintWriter |
Type | Name and description |
---|---|
void |
decrementIndent() |
void |
flush() |
boolean |
getAutoIndent() |
int |
getIndentLevel() |
void |
incrementIndent() |
void |
print(String text) Prints a string. |
void |
print(char c) Prints a character. |
void |
printIndent() Prints the current indent level. |
void |
println(String text) Prints a string followed by an end of line character. |
void |
println() Prints an end-of-line character (if enabled via addNewLines property). |
void |
setAutoIndent(boolean autoIndent) |
void |
setIndentLevel(int indentLevel) |
Creates an IndentPrinter backed by a PrintWriter pointing to System.out, with an indent of two spaces.
Creates an IndentPrinter backed by the supplied Writer, with an indent of two spaces.
out
- Writer to output toCreates an IndentPrinter backed by the supplied Writer, with a user-supplied String to be used for indenting.
out
- Writer to output toindent
- character(s) used to indent each lineCreates an IndentPrinter backed by the supplied Writer, with a user-supplied String to be used for indenting and the ability to override newline handling.
out
- Writer to output toindent
- character(s) used to indent each lineaddNewlines
- set to false to gobble all new lines (default true)Create an IndentPrinter to the given PrintWriter
out
- Writer to output toindent
- character(s) used to indent each lineaddNewlines
- set to false to gobble all new lines (default true)autoIndent
- set to true to make println() prepend the indent automatically (default false)Prints a string.
text
- String to be writtenPrints a character.
c
- char to be writtenPrints the current indent level.
Prints a string followed by an end of line character.
text
- String to be writtenPrints an end-of-line character (if enabled via addNewLines property). Defaults to outputting a single '\n' character but by using a custom Writer, e.g. PlatformLineWriter, you can get platform-specific end-of-line characters.
Copyright © 2003-2015 The Apache Software Foundation. All rights reserved.