Package org.rrd4j.core
Class XmlWriter
java.lang.Object
org.rrd4j.core.XmlWriter
- All Implemented Interfaces:
AutoCloseable
Extremely simple utility class used to create XML documents.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionXmlWriter
(OutputStream stream) Creates XmlWriter with the specifiedOutputStream
to send XML code to.XmlWriter
(OutputStream stream, boolean autoFlush) Creates XmlWriter with the specified output stream to send XML code to.XmlWriter
(PrintWriter stream) Creates XmlWriter with the specifiedPrintWriter
to send XML code to. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
closeTag()
Closes the corresponding XML tagvoid
flush()
Flushes the output streamformatTimestamp
(long timestamp) Format a timestamp using the configuredDateTimeFormatter
void
Opens XML tagwithDoubleFormatter
(XmlWriter.DoubleFormater doubleFormatter) Return a newXmlWriter
that will format time stamp using thisZoneId
withTimeZone
(java.time.ZoneId zid) Return a newXmlWriter
that will format time stamp as ISO 8601 with this explicit time zoneZoneId
void
writeComment
(long timestamp) Writes a timestamp using the configuredDateTimeFormatter
as an XML comment to output streamvoid
writeComment
(Object comment) Writes XML comment to output streamvoid
Writes <tag>value</tag> to output streamvoid
Writes <tag>value</tag> to output streamvoid
Writes <tag>value</tag> to output streamvoid
Writes <tag>value</tag> to output streamvoid
Writes <tag>value</tag> to output streamvoid
Writes <tag>value</tag> to output streamvoid
Writes <tag>value</tag> to output streamvoid
Writes <tag>value</tag> to output streamvoid
Writes <tag>value</tag> to output stream
-
Field Details
-
INDENT_STR
- See Also:
-
-
Constructor Details
-
XmlWriter
Creates XmlWriter with the specifiedOutputStream
to send XML code to.- Parameters:
stream
-OutputStream
which receives XML code
-
XmlWriter
Creates XmlWriter with the specified output stream to send XML code to.- Parameters:
stream
- Output stream which receives XML codeautoFlush
- is the stream to be flushed automatically
-
XmlWriter
Creates XmlWriter with the specifiedPrintWriter
to send XML code to.- Parameters:
stream
-PrintWriter
which receives XML code
-
-
Method Details
-
withTimeZone
Return a newXmlWriter
that will format time stamp as ISO 8601 with this explicit time zoneZoneId
- Parameters:
zid
-- Returns:
- the XmlWriter
-
withDoubleFormatter
Return a newXmlWriter
that will format time stamp using thisZoneId
- Parameters:
doubleFormatter
-- Returns:
- the XmlWriter
-
startTag
Opens XML tag- Parameters:
tag
- XML tag name
-
closeTag
public void closeTag()Closes the corresponding XML tag -
writeTag
Writes <tag>value</tag> to output stream- Parameters:
tag
- XML tag namevalue
- value to be placed between<tag>
and</tag>
-
writeTag
Writes <tag>value</tag> to output stream- Parameters:
tag
- XML tag namevalue
- value to be placed between<tag>
and</tag>
-
writeTag
Writes <tag>value</tag> to output stream- Parameters:
tag
- XML tag namevalue
- value to be placed between<tag>
and</tag>
-
writeTag
Writes <tag>value</tag> to output stream- Parameters:
tag
- XML tag namevalue
- value to be placed between<tag>
and</tag>
nanString
- aString
object.
-
writeTag
Writes <tag>value</tag> to output stream- Parameters:
tag
- XML tag namevalue
- value to be placed between<tag>
and</tag>
-
writeTag
Writes <tag>value</tag> to output stream- Parameters:
tag
- XML tag namevalue
- value to be placed between<tag>
and</tag>
-
writeTag
Writes <tag>value</tag> to output stream- Parameters:
tag
- XML tag namevalue
- value to be placed between<tag>
and</tag>
-
writeTag
Writes <tag>value</tag> to output stream- Parameters:
tag
- XML tag namevalue
- value to be placed between<tag>
and</tag>
-
writeTag
Writes <tag>value</tag> to output stream- Parameters:
tag
- XML tag namevalue
- value to be placed between<tag>
and</tag>
-
flush
public void flush()Flushes the output stream -
writeComment
Writes XML comment to output stream- Parameters:
comment
- comment string
-
writeComment
public void writeComment(long timestamp) Writes a timestamp using the configuredDateTimeFormatter
as an XML comment to output stream- Parameters:
timestamp
-
-
formatTimestamp
Format a timestamp using the configuredDateTimeFormatter
- Parameters:
timestamp
-- Returns:
- the formatted timestamp
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-