Package org.omegat.filters3.xml
Class XMLWriter
java.lang.Object
java.io.Writer
org.omegat.filters3.xml.XMLWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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 Details
-
XMLWriter
public XMLWriter(File file, @Nullable String encoding, @Nullable String eol) throws FileNotFoundException, UnsupportedEncodingException Creates new XMLWriter.- Parameters:
file- file name to write toencoding- encoding to write a file ineol- End-Of-Line character- Throws:
FileNotFoundExceptionUnsupportedEncodingException
-
-
Method Details
-
close
Flushes the writer (which does the real write-out of data) and closes the real writer.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException
-
flush
Does the real write-out of the data, first adding/replacing encoding statement.- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException
-
write
Write a portion of an array of characters. Simply callswrite(char[], int, int)of the internalStringWriter.- Specified by:
writein classWriter- Parameters:
cbuf- - Array of charactersoff- - Offset from which to start writing characterslen- - Number of characters to write- Throws:
IOException- - If an I/O error occurs
-