- All Known Implementing Classes:
JavaScriptWriter,JsonWriter,LdJsonWriter,MysqlWriter,PsqlWriter,ShWriter,StyleWriter,TextWriter,WhitespaceWriter,XhtmlAttributeWriter,XhtmlWriter
- Author:
- AO Industries, Inc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe number of space characters per indentation level.static final charThe character used for newlines.static final charThe character used for space, which is' '. -
Method Summary
Modifier and TypeMethodDescriptiondecDepth()Decrements the indentation depth, if enabled.intgetDepth()Gets the current indentation depth, which begins at zero.booleanGets if indentation is currently enabled, off by default.incDepth()Increments the indentation depth, if enabled.default Whitespaceindent()Writes the current indentation when indentation enabled.default Whitespaceindent(int depthOffset) Writes the current indentation with a depth offset when indentation enabled.nl()Writes a newline.default Whitespacenli()Writes a newline, followed by current indentation when indentation enabled.default Whitespacenli(int depthOffset) Writes a newline, followed by current indentation with a depth offset when indentation enabled.setDepth(int depth) Sets the indentation depth.setIndent(boolean indent) Enables or disabled indentation.default Whitespacesp()Writes one space character.sp(int count) Writes the given number of space characters.
-
Field Details
-
NL
static final char NLThe character used for newlines.This is
'\n'on all platforms. If a different newline is required, such as"\r\n"for email, filter the output.- See Also:
-
INDENT_SPACES
static final int INDENT_SPACESThe number of space characters per indentation level.- See Also:
-
SPACE
static final char SPACEThe character used for space, which is' '.- See Also:
-
-
Method Details
-
nl
Writes a newline.This is
'\n'on all platforms. If a different newline is required, such as"\r\n"for email, filter the output.- Returns:
thiswriter- Throws:
IOException- See Also:
-
nli
Writes a newline, followed by current indentation when indentation enabled.This is
'\n'on all platforms. If a different newline is required, such as"\r\n"for email, filter the output.- Returns:
thiswriter- Throws:
IOException- See Also:
-
nli
Writes a newline, followed by current indentation with a depth offset when indentation enabled.This is
'\n'on all platforms. If a different newline is required, such as"\r\n"for email, filter the output.- Parameters:
depthOffset- A value added to the current indentation depth. For example, pass-1when performing a newline before a closing tag or ending curly brace.- Returns:
thiswriter- Throws:
IOException- See Also:
-
indent
Writes the current indentation when indentation enabled.- Returns:
thiswriter- Throws:
IOException- See Also:
-
indent
Writes the current indentation with a depth offset when indentation enabled.- Parameters:
depthOffset- A value added to the current indentation depth. For example, pass-1when performing a newline before a closing tag or ending curly brace.- Returns:
thiswriter- Throws:
IOException- See Also:
-
getIndent
boolean getIndent()Gets if indentation is currently enabled, off by default. -
setIndent
Enables or disabled indentation.- Returns:
thiswriter
-
getDepth
int getDepth()Gets the current indentation depth, which begins at zero. This value is not updated when indentation is disabled. Not all tags will trigger indentation. -
setDepth
Sets the indentation depth.- Returns:
thiswriter
-
incDepth
Whitespace incDepth()Increments the indentation depth, if enabled.- Returns:
thiswriter
-
decDepth
Whitespace decDepth()Decrements the indentation depth, if enabled.- Returns:
thiswriter
-
sp
Writes one space character.- Returns:
thiswriter- Throws:
IOException- See Also:
-
sp
Writes the given number of space characters.- Parameters:
count- Whencount <= 0, nothing is written.- Returns:
thiswriter- Throws:
IOException- See Also:
-
