Class MicroWriter
java.lang.Object
com.helger.xml.microdom.serialize.MicroWriter
Utility class for serializing micro document objects.
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]getNodeAsBytes(IMicroNode aNode) Convert the passed micro node to an XML byte array usingXMLWriterSettings.DEFAULT_XML_SETTINGS.static byte[]getNodeAsBytes(IMicroNode aNode, IXMLWriterSettings aSettings) Convert the passed micro node to an XML byte array using the provided settings.static StringgetNodeAsString(IMicroNode aNode) Convert the passed micro node to an XML string usingXMLWriterSettings.DEFAULT_XML_SETTINGS.static StringgetNodeAsString(IMicroNode aNode, IXMLWriterSettings aSettings) Convert the passed micro node to an XML string using the provided settings.static com.helger.commons.state.ESuccesswriteToFile(IMicroNode aNode, File aFile) Write a Micro Node to a file using the default settings.static com.helger.commons.state.ESuccesswriteToFile(IMicroNode aNode, File aFile, IXMLWriterSettings aSettings) Write a Micro Node to a file.static com.helger.commons.state.ESuccesswriteToFile(IMicroNode aNode, Path aPath) Write a Micro Node to a file using the default settings.static com.helger.commons.state.ESuccesswriteToFile(IMicroNode aNode, Path aPath, IXMLWriterSettings aSettings) Write a Micro Node to a file.static com.helger.commons.state.ESuccesswriteToStream(IMicroNode aNode, OutputStream aOS) Write a Micro Node to an output stream using the default settings.static com.helger.commons.state.ESuccesswriteToStream(IMicroNode aNode, OutputStream aOS, IXMLWriterSettings aSettings) Write a Micro Node to anOutputStream.static com.helger.commons.state.ESuccesswriteToWriter(IMicroNode aNode, Writer aWriter) Write a Micro Node to aWriterusing the defaultXMLWriterSettings.DEFAULT_XML_SETTINGS.static com.helger.commons.state.ESuccesswriteToWriter(IMicroNode aNode, Writer aWriter, IXMLWriterSettings aSettings) Write a Micro Node to aWriter.
-
Method Details
-
writeToFile
@Nonnull public static com.helger.commons.state.ESuccess writeToFile(@Nonnull IMicroNode aNode, @Nonnull File aFile) Write a Micro Node to a file using the default settings.- Parameters:
aNode- The node to be serialized. May be any kind of node (incl. documents). May not benull.aFile- The file to write to. May not benull.- Returns:
ESuccess
-
writeToFile
@Nonnull public static com.helger.commons.state.ESuccess writeToFile(@Nonnull IMicroNode aNode, @Nonnull File aFile, @Nonnull IXMLWriterSettings aSettings) Write a Micro Node to a file.- Parameters:
aNode- The node to be serialized. May be any kind of node (incl. documents). May not benull.aFile- The file to write to. May not benull.aSettings- The settings to be used for the creation. May not benull.- Returns:
ESuccess
-
writeToFile
@Nonnull public static com.helger.commons.state.ESuccess writeToFile(@Nonnull IMicroNode aNode, @Nonnull Path aPath) Write a Micro Node to a file using the default settings.- Parameters:
aNode- The node to be serialized. May be any kind of node (incl. documents). May not benull.aPath- The file to write to. May not benull.- Returns:
ESuccess
-
writeToFile
@Nonnull public static com.helger.commons.state.ESuccess writeToFile(@Nonnull IMicroNode aNode, @Nonnull Path aPath, @Nonnull IXMLWriterSettings aSettings) Write a Micro Node to a file.- Parameters:
aNode- The node to be serialized. May be any kind of node (incl. documents). May not benull.aPath- The file to write to. May not benull.aSettings- The settings to be used for the creation. May not benull.- Returns:
ESuccess
-
writeToStream
@Nonnull public static com.helger.commons.state.ESuccess writeToStream(@Nonnull IMicroNode aNode, @Nonnull @WillClose OutputStream aOS) Write a Micro Node to an output stream using the default settings.- Parameters:
aNode- The node to be serialized. May be any kind of node (incl. documents). May not benull.aOS- The output stream to write to. May not benull. The output stream is closed anyway directly after the operation finishes (on success and on error).- Returns:
ESuccess
-
writeToStream
@Nonnull public static com.helger.commons.state.ESuccess writeToStream(@Nonnull IMicroNode aNode, @Nonnull @WillClose OutputStream aOS, @Nonnull IXMLWriterSettings aSettings) Write a Micro Node to anOutputStream.- Parameters:
aNode- The node to be serialized. May be any kind of node (incl. documents). May not benull.aOS- The output stream to write to. May not benull. The output stream is closed anyway directly after the operation finishes (on success and on error).aSettings- The settings to be used for the creation. May not benull.- Returns:
ESuccess
-
writeToWriter
@Nonnull public static com.helger.commons.state.ESuccess writeToWriter(@Nonnull IMicroNode aNode, @Nonnull @WillClose Writer aWriter, @Nonnull IXMLWriterSettings aSettings) Write a Micro Node to aWriter.- Parameters:
aNode- The node to be serialized. May be any kind of node (incl. documents). May not benull.aWriter- The writer to write to. May not benull. The writer is closed anyway directly after the operation finishes (on success and on error).aSettings- The settings to be used for the creation. May not benull.- Returns:
ESuccess
-
writeToWriter
@Nonnull public static com.helger.commons.state.ESuccess writeToWriter(@Nonnull IMicroNode aNode, @Nonnull @WillClose Writer aWriter) Write a Micro Node to aWriterusing the defaultXMLWriterSettings.DEFAULT_XML_SETTINGS.- Parameters:
aNode- The node to be serialized. May be any kind of node (incl. documents). May not benull.aWriter- The writer to write to. May not benull. The writer is closed anyway directly after the operation finishes (on success and on error).- Returns:
ESuccess- Since:
- 8.6.3
-
getNodeAsString
@Nullable public static String getNodeAsString(@Nonnull IMicroNode aNode, @Nonnull IXMLWriterSettings aSettings) Convert the passed micro node to an XML string using the provided settings.- Parameters:
aNode- The node to be converted to a string. May not benull.aSettings- The XML writer settings to use. May not benull.- Returns:
- The string representation of the passed node.
-
getNodeAsString
Convert the passed micro node to an XML string usingXMLWriterSettings.DEFAULT_XML_SETTINGS. This is a specialized version ofgetNodeAsString(IMicroNode, IXMLWriterSettings).- Parameters:
aNode- The node to be converted to a string. May not benull.- Returns:
- The string representation of the passed node.
- Since:
- 8.6.3
-
getNodeAsBytes
@Nullable public static byte[] getNodeAsBytes(@Nonnull IMicroNode aNode, @Nonnull IXMLWriterSettings aSettings) Convert the passed micro node to an XML byte array using the provided settings.- Parameters:
aNode- The node to be converted to a byte array. May not benull.aSettings- The XML writer settings to use. May not benull.- Returns:
- The byte array representation of the passed node.
- Since:
- 8.6.3
-
getNodeAsBytes
Convert the passed micro node to an XML byte array usingXMLWriterSettings.DEFAULT_XML_SETTINGS. This is a specialized version ofgetNodeAsBytes(IMicroNode, IXMLWriterSettings).- Parameters:
aNode- The node to be converted to a byte array. May not benull.- Returns:
- The byte array representation of the passed node.
- Since:
- 8.6.3
-