Class XMLWriter

java.lang.Object
java.io.Writer
org.omegat.filters3.xml.XMLWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public class XMLWriter extends Writer
This class writes out the XML files, intercepting the output. First it collects all the output inside itself in a string. Then it adds the specified encoding declaration (or replaces the encoding) and writes out the file in the encoding.
  • Constructor Details

  • Method Details

    • close

      public void close() throws IOException
      Flushes the writer (which does the real write-out of data) and closes the real writer.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in class Writer
      Throws:
      IOException
    • flush

      public void flush() throws IOException
      Does the real write-out of the data, first adding/replacing encoding statement.
      Specified by:
      flush in interface Flushable
      Specified by:
      flush in class Writer
      Throws:
      IOException
    • write

      public void write(char[] cbuf, int off, int len) throws IOException
      Write a portion of an array of characters. Simply calls write(char[], int, int) of the internal StringWriter.
      Specified by:
      write in class Writer
      Parameters:
      cbuf - - Array of characters
      off - - Offset from which to start writing characters
      len - - Number of characters to write
      Throws:
      IOException - - If an I/O error occurs