Class AbstractWriter

java.lang.Object
org.ujorm.tools.xml.AbstractWriter
Direct Known Subclasses:
XmlPrinter, XmlWriter

public abstract class AbstractWriter extends Object
A generic writer
Author:
Pavel Ponec
  • Field Details

  • Constructor Details

    • AbstractWriter

      public AbstractWriter(@NotNull @NotNull Appendable out, @NotNull @NotNull XmlConfig config)
      A writer constructor
      Parameters:
      out - A writer
      config - XML configuration
  • Method Details

    • write

      public final void write(@NotNull @NotNull CharSequence text, boolean attribute) throws IOException
      Write escaped value to the output
      Parameters:
      text - A value to write
      attribute - Write an attribute value
      Throws:
      IOException
    • writeValue

      public void writeValue(@Nullable @Nullable Object value, @NotNull @NotNull ApiElement element, @Nullable @Nullable String attributeName) throws IOException
      Write escaped value to the output
      Parameters:
      value - A value to write, where the null value is ignored silently.
      element - The element
      attributeName - A name of the XML attribute of null value for a XML text.
      Throws:
      IOException
    • writeRawValue

      public final void writeRawValue(@NotNull @NotNull CharSequence rawValue, @NotNull @NotNull ApiElement element) throws IOException
      Write the content of an envelope
      Parameters:
      rawValue - A raw value to print
      element - An original element
      Throws:
      IOException
    • writeNewLine

      public void writeNewLine(int level) throws IOException
      Write a new line with an offset by the current level
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getWriter

      @NotNull public @NotNull Appendable getWriter()
      For internal usage only
    • getWriterEscaped

      @NotNull public @NotNull Appendable getWriterEscaped()
      Get Writer to escape HTML characters.
    • createWriter

      @NotNull public static @NotNull Appendable createWriter(@NotNull @NotNull Object httpServletResponse, @NotNull @NotNull Charset charset, boolean noCache) throws ReflectiveOperationException
      Assign a no-cache and an Edge compatibility mode and returns a writer from HttpServletResponse
      Throws:
      ReflectiveOperationException