public class SimpleXmlWriter extends Object
Modifier and Type | Field and Description |
---|---|
protected int |
indentCounter
Integer keeping track of the number of indents to include at the
beginning of each line.
|
Constructor and Description |
---|
SimpleXmlWriter(BufferedWriter bw)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the buffered writer.
|
void |
decreaseIndent()
Decreases the indent counter.
|
String |
getIndentString()
Returns the indent string to use, e.g.
|
void |
increaseIndent()
Increases the indent counter.
|
void |
newLine()
Adds an end of line character.
|
void |
setIndentString(String indentString)
Sets the indent string to use, e.g.
|
void |
write(String content)
Writes the content to the file.
|
void |
writeIndent()
Writes the current indent.
|
void |
writeLine(String line)
Writes the given line.
|
void |
writeLineDecreasedIndent(String line)
Writes the given line with a decreased indent.
|
void |
writeLineIncreasedIndent(String line)
Writes the given line with an increased indent.
|
protected int indentCounter
public SimpleXmlWriter(BufferedWriter bw)
bw
- the buffered writer to use.public String getIndentString()
public void setIndentString(String indentString)
indentString
- the indent string to usepublic void writeIndent() throws IOException
IOException
- exception thrown whenever an error occurs while
writingpublic void write(String content) throws IOException
content
- the content as StringIOException
- exception thrown whenever an error occurs while
writingpublic void writeLine(String line) throws IOException
line
- the line to writeIOException
- exception thrown whenever an error occurs while
writingpublic void writeLineIncreasedIndent(String line) throws IOException
line
- the line to writeIOException
- exception thrown whenever an error occurs while
writingpublic void writeLineDecreasedIndent(String line) throws IOException
line
- the line to writeIOException
- exception thrown whenever an error occurs while
writingpublic void newLine() throws IOException
IOException
- exception thrown whenever an error occurs while
writingpublic void increaseIndent()
public void decreaseIndent()
public void close() throws IOException
IOException
- Exception thrown whenever an error occurred
while closing the file.Copyright © 2019. All rights reserved.