public class DynamicWriteXML
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.io.BufferedWriter |
bufferedWriter
Buffer writer use to write on the stream
|
private boolean |
closeWriterAtEnd
Indicates if have to close writer when finish
|
private static java.lang.String |
COMMENT_END
End of comment
|
private static java.lang.String |
COMMENT_START
Start of comment
|
private java.util.Stack<java.lang.String> |
markups
Current stack of markups
|
private int |
status
Current status
|
private static int |
STATUS_HAVE_TO_OPEN_MARKUP
Status indicate that a markup have to be open
|
private static int |
STATUS_MARKUP_CLOSED
Status indicates that a markup just be closed
|
private static int |
STATUS_MARKUP_OPENED
Status indicates that a markup is open
|
private static int |
STATUS_TERMINATE
Status indicates that all is finsish
|
private static int |
STATUS_TEXT_WRITEN
Status indicates that a text just writen
|
private int |
tab
Current number of tabulation
|
private static java.lang.String |
TAB
Tabulation characters
|
private boolean |
textSameLine
Indicates if the text is on same line as the markup that contains it
|
private static java.lang.String |
UTF8_FORMAT
UTF 8 header
|
| Constructor and Description |
|---|
DynamicWriteXML(java.io.OutputStream outputStream)
Create a new instance of DynamicWriteXML not compact and text in separate line
|
DynamicWriteXML(java.io.OutputStream outputStream,
boolean textSameLine)
Create a new instance of DynamicWriteXML not compact
|
DynamicWriteXML(java.io.OutputStream outputStream,
boolean compact,
boolean textSameLine)
Create a new instance of DynamicWriteXML
|
DynamicWriteXML(java.io.OutputStream outputStream,
boolean compact,
boolean textSameLine,
boolean closeWriterAtEnd)
Create a new instance of DynamicWriteXML
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendComment(java.lang.String comment)
Add a comment
|
void |
appendParameter(java.lang.String name,
boolean value)
Append a boolean parameter at current markup
|
void |
appendParameter(java.lang.String name,
int value)
Append a int parameter at current markup
|
void |
appendParameter(java.lang.String name,
java.lang.String value)
Append a string parameter to current markup
|
boolean |
closeMarkup()
Close current markup
|
void |
openMarkup(java.lang.String markup)
Open a markup
|
void |
setText(java.lang.String text)
Append a text to current markup
|
private static final java.lang.String COMMENT_END
private static final java.lang.String COMMENT_START
private static final int STATUS_HAVE_TO_OPEN_MARKUP
private static final int STATUS_MARKUP_CLOSED
private static final int STATUS_MARKUP_OPENED
private static final int STATUS_TERMINATE
private static final int STATUS_TEXT_WRITEN
private static final java.lang.String TAB
private static final java.lang.String UTF8_FORMAT
private final java.io.BufferedWriter bufferedWriter
private final boolean closeWriterAtEnd
private final java.util.Stack<java.lang.String> markups
private int status
private int tab
private final boolean textSameLine
public DynamicWriteXML(java.io.OutputStream outputStream)
throws java.io.IOException
outputStream - Stream where writejava.io.IOException - On writing header issuepublic DynamicWriteXML(java.io.OutputStream outputStream,
boolean textSameLine)
throws java.io.IOException
outputStream - Stream where writetextSameLine - Indicates if text have to be in same linejava.io.IOException - On writing header issuepublic DynamicWriteXML(java.io.OutputStream outputStream,
boolean compact,
boolean textSameLine)
throws java.io.IOException
outputStream - Stream where writecompact - Indicates if use compact modetextSameLine - Indicates if text at same line as its markup. Text will be forced in same line if compact mode is truejava.io.IOException - On writing header issuepublic DynamicWriteXML(java.io.OutputStream outputStream,
boolean compact,
boolean textSameLine,
boolean closeWriterAtEnd)
throws java.io.IOException
outputStream - Stream where writecompact - Indicates if use compact modetextSameLine - Indicates if text at same line as its markup. Text will be forced in same line if compact mode is truecloseWriterAtEnd - Indicates if have to close the stream when finishjava.io.IOException - On writing header issuepublic void appendComment(java.lang.String comment)
throws java.io.IOException
comment - Comment to addjava.io.IOException - On writing issuepublic void appendParameter(java.lang.String name,
boolean value)
throws java.io.IOException
name - Parameter namevalue - Parameter valuejava.io.IOException - On writing issuepublic void appendParameter(java.lang.String name,
int value)
throws java.io.IOException
name - Parameter namevalue - Parameter valuejava.io.IOException - On writing issuepublic void appendParameter(java.lang.String name,
java.lang.String value)
throws java.io.IOException
name - Parameter namevalue - Parameter valuejava.io.IOException - On writing issuepublic boolean closeMarkup()
throws java.io.IOException
true if there are more markup to close. false if this is the last markup close and the the XML
writing is finishjava.io.IOException - On writing issuepublic void openMarkup(java.lang.String markup)
throws java.io.IOException
markup - Markup namejava.io.IOException - On writing issuepublic void setText(java.lang.String text)
throws java.io.IOException
text - Text to writejava.io.IOException - On writing issue