public class XLIFFWriter
extends java.lang.Object
implements java.io.Closeable
| Constructor and Description |
|---|
XLIFFWriter() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the output document.
|
void |
create(java.io.File file,
java.lang.String sourceLang)
Creates a new XLIFF document
|
void |
create(java.io.File file,
java.lang.String sourceLang,
java.lang.String targetLang)
Creates a new document with a given file, with a source language and a target language.
|
void |
create(java.io.Writer output,
java.lang.String sourceLang)
Creates a new document for a given writer and a source language.
|
void |
create(java.io.Writer output,
java.lang.String sourceLang,
java.lang.String targetLang)
Creates a new XLIFF document.
|
java.lang.String |
getLineBreak()
Gets the line break to use for this document.
|
javax.xml.namespace.NamespaceContext |
getNamespaceContext()
Gets the namespace context for this writer.
|
boolean |
getWithOriginalData()
Gets the flag indicating whether or not to output original data entries.
|
void |
setLineBreak(java.lang.String lineBreak)
Sets the line break to use for this document.
|
void |
setStartFileData(StartFileData startFileData)
Sets the
StartFileData object to use for the next writeStartFile(StartFileData) call. |
void |
setUseIndentation(boolean useIndentation)
Sets whether or not indentations should be used for this document.
|
void |
setUseInsignificantParts(boolean useInsignificantParts) |
void |
setWithOriginalData(boolean withOriginalData)
Sets the flag indicating whether or not to output original data entries.
|
void |
writeEndDocument()
Writes the end of the document (the
</xliff> tag). |
void |
writeEndFile()
Writes the end of the file (the
</file> tag). |
void |
writeEndGroup()
Writes the end of a <group> element.
|
void |
writeEvent(Event event)
Writes a given event.
|
void |
writeMidFile(MidFileData midFileData)
Writes the mid part of an <file> document.
|
void |
writeSkeleton(Skeleton skelData)
Writes the
|
void |
writeStartDocument(StartXliffData docData,
java.lang.String comment)
Writes the start of the document (the
<xliff> tag). |
void |
writeStartFile(StartFileData newFileData)
Writes the start of a <file> element.
|
void |
writeStartGroup(StartGroupData startGroupData)
Writes the start of a <group> element.
|
void |
writeUnit(Unit unit)
Writes a
<unit> element. |
public void create(java.io.File file,
java.lang.String sourceLang,
java.lang.String targetLang)
file - the file where to create this document. If needed directories will be created
automatically to create this file.sourceLang - the source language for this document (can be null if set later).targetLang - the target language for this document (can be null).XLIFFWriterException - if an error occurs.public void create(java.io.File file,
java.lang.String sourceLang)
file - the output file where to write this document.sourceLang - the source language for this document (can be null if set later).public void create(java.io.Writer output,
java.lang.String sourceLang,
java.lang.String targetLang)
output - the writer to use to output this document.sourceLang - the source language for this document (can be null if set later).targetLang - the target language for this document (can be null).public void create(java.io.Writer output,
java.lang.String sourceLang)
output - the writer to use to output this document.sourceLang - the source language for this document (cannot be null or empty).public void setWithOriginalData(boolean withOriginalData)
withOriginalData - true to output the original data, false otherwise.public boolean getWithOriginalData()
public void setLineBreak(java.lang.String lineBreak)
create() methods.
By default the line-break used is the one of the OS.lineBreak - the line break to use for this document.public java.lang.String getLineBreak()
public void setUseIndentation(boolean useIndentation)
useIndentation - true to use indentation, false to not use indentations.public void setUseInsignificantParts(boolean useInsignificantParts)
public void close()
If writeEndDocument() has not been called, it is called automatically.
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic void writeEvent(Event event)
event - the event to output.public void writeUnit(Unit unit)
<unit> element.
If writeStartFile(StartFileData) has not been called yet, it is called automatically.
unit - the Unit object to write.public void writeStartDocument(StartXliffData docData, java.lang.String comment)
<xliff> tag).docData - the document data.comment - an optional comment that is placed just after the <xliff> tag
(use null for no comment).public void writeEndDocument()
</xliff> tag).
If writeEndFile() has not been called, it is called automatically.
public void setStartFileData(StartFileData startFileData)
StartFileData object to use for the next writeStartFile(StartFileData) call.
You can use this method to set the file-level data to use next time the writeStartFile(StartFileData)
method is automatically call or called with a null parameter. This can be use to avoid writing the start of the
<file> element directly in case there is no data to extract for example.
This object stays available until the next writeEndFile() call.startFileData - the object to use for the next writeStartFile(StartFileData) call.public void writeStartFile(StartFileData newFileData)
If needed writeStartDocument(StartXliffData, String) is called automatically before.
newFileData - the data associated with the start of a XLIFF <file> element (can be null).
You can use setStartFileData(StartFileData) to set this parameter before calling this
method (then use null here).public void writeMidFile(MidFileData midFileData)
If needed writeStartFile(StartFileData) is called automatically before.
midFileData - the data associated with a mid part of a <file> element (can be null).public void writeSkeleton(Skeleton skelData)
If writeStartFile(StartFileData) has not been called, it is called automatically.
If the skeleton attribute was used in <file>, an error occurs.
skelData - the Skeleton object (must not be null).XLIFFWriterException - if an error occurs.public void writeEndFile()
</file> tag).
Nothing is written if no file has been started.
public void writeStartGroup(StartGroupData startGroupData)
If needed writeStartFile(StartFileData) is called before.
startGroupData - the data associated with the group (can be null).public void writeEndGroup()
public javax.xml.namespace.NamespaceContext getNamespaceContext()