Package org.omegat.filters3.xml
Class XMLWriter
- java.lang.Object
-
- java.io.Writer
-
- org.omegat.filters3.xml.XMLWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class XMLWriter extends java.io.WriterThis 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 Summary
Constructors Constructor Description XMLWriter(java.io.File file, java.lang.String encoding, java.lang.String eol)Creates new XMLWriter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Flushes the writer (which does the real write-out of data) and closes the real writer.voidflush()Does the real write-out of the data, first adding/replacing encoding statement.voidwrite(char[] cbuf, int off, int len)Write a portion of an array of characters.
-
-
-
Constructor Detail
-
XMLWriter
public XMLWriter(java.io.File file, java.lang.String encoding, java.lang.String eol) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingExceptionCreates new XMLWriter.- Parameters:
fileName- file name to write toencoding- encoding to write a file in- Throws:
java.io.FileNotFoundExceptionjava.io.UnsupportedEncodingException
-
-
Method Detail
-
close
public void close() throws java.io.IOExceptionFlushes the writer (which does the real write-out of data) and closes the real writer.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Writer- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOExceptionDoes the real write-out of the data, first adding/replacing encoding statement.- Specified by:
flushin interfacejava.io.Flushable- Specified by:
flushin classjava.io.Writer- Throws:
java.io.IOException
-
write
public void write(char[] cbuf, int off, int len) throws java.io.IOExceptionWrite a portion of an array of characters. Simply callswrite(char[], int, int)of the internalStringWriter.- Specified by:
writein classjava.io.Writer- Parameters:
cbuf- - Array of charactersoff- - Offset from which to start writing characterslen- - Number of characters to write- Throws:
java.io.IOException- - If an I/O error occurs
-
-