public class XMLTranslationWriter extends java.lang.Object implements TranslationWriter
TranslationWriter
that writes its output in our custom XML format.
I/O errors in the underlying Writer
in any of its methods throw an
unchecked RuntimeException
.Constructor and Description |
---|
XMLTranslationWriter(java.io.Writer out)
Creates a new instance that writes its output through the given
Writer |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying output stream, flushing it first.
|
void |
flush()
Flushes the underlying output stream.
|
void |
writeEnd()
Writes the end of the output.
|
void |
writeFragment(java.lang.String fragment)
Writes an untranslated text fragment to the output.
|
void |
writeTranslatedFragment(java.lang.String srcFragment,
java.lang.String translation)
Writes a translated text fragment to the output.
|
public XMLTranslationWriter(java.io.Writer out) throws java.io.IOException
Writer
out
- the Writer
to write the output to.java.io.IOException
- if some sort of writing error occurs.public void writeFragment(java.lang.String fragment)
TranslationWriter
writeFragment
in interface TranslationWriter
fragment
- the untranslated fragment to write.public void writeTranslatedFragment(java.lang.String srcFragment, java.lang.String translation)
TranslationWriter
writeTranslatedFragment
in interface TranslationWriter
srcFragment
- the source text fragment.translation
- the translation that corresponds to the source text fragment.public void writeEnd()
TranslationWriter
writeEnd
in interface TranslationWriter
public void flush()
TranslationWriter
flush
in interface TranslationWriter
public void close()
TranslationWriter
close
in interface TranslationWriter