Class XmlWriter

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Map<java.lang.Character,​java.lang.String> ENCODING
      The output writer to save the values to.
      protected java.io.PrintWriter out  
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlWriter​(java.io.PrintWriter out)
      Constructs a new XmlWriter.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      static java.lang.String encode​(java.lang.String unencoded)
      Encode the given string in XML1.0 format.
      static java.lang.String encode​(java.lang.String unencoded, boolean keepApos)
      Encode the given string in XML1.0 format.
      void flush()
      Flushes the stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • out

        protected final java.io.PrintWriter out
      • ENCODING

        private static final java.util.Map<java.lang.Character,​java.lang.String> ENCODING
        The output writer to save the values to.
    • Constructor Detail

      • XmlWriter

        public XmlWriter​(java.io.PrintWriter out)
        Constructs a new XmlWriter.
        Parameters:
        out - print writer
    • Method Detail

      • flush

        public void flush()
        Flushes the stream.
      • encode

        public static java.lang.String encode​(java.lang.String unencoded)
        Encode the given string in XML1.0 format. Optimized to fast pass strings that don't need encoding (normal case).
        Parameters:
        unencoded - the unencoded input string
        Returns:
        XML1.0 string
      • encode

        public static java.lang.String encode​(java.lang.String unencoded,
                                              boolean keepApos)
        Encode the given string in XML1.0 format. Optimized to fast pass strings that don't need encoding (normal case).
        Parameters:
        unencoded - the unencoded input string
        keepApos - true if apostrophe sign should stay as it is (in order to work around a Java bug that renders new JLabel("<html>&apos;</html>") literally as 6 character string, see #7558)
        Returns:
        XML1.0 string
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException