public class SkeletonMergerWriter extends Object implements IFilterWriter
Takes a skeleton file and Events from a translated document.
Translated segments are merged into the skeleton TextUnit events and
written out using the default IFilterWriter
| Constructor and Description |
|---|
SkeletonMergerWriter() |
SkeletonMergerWriter(IFilter skeletonFilter,
IFilterWriter writer,
ITextUnitMerger textUnitMerger)
Use specific
IFilter and IFilterWriter implementations |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels the current process.
|
void |
close()
Closes the output.
|
EncoderManager |
getEncoderManager()
Gets the current encoder manager for this writer.
|
String |
getName()
Gets the name of this writer.
|
Parameters |
getParameters()
Gets the current parameters for this writer.
|
ISkeletonWriter |
getSkeletonWriter()
Gets the skeleton writer associated with this writer.
|
Event |
handleEvent(Event event)
Handles the filter events.
|
protected void |
processEndDocument()
There are no more
TextUnits. |
protected void |
processStartDocument()
Use the skeleton
StartDocument event to initialize the
IFilterWriter. |
protected void |
processTextUnit(Event event)
Take the translated
TextUnit and match it up with its corresponding
skeleton version. |
protected Event |
processUntilTextUnit()
Get events in the original document until the next text unit.
|
void |
setFilter(IFilter skeletonFilter)
Set the
IFilter needed to process the skeleton file (normally the
original document) |
void |
setOptions(LocaleId targetLocale,
String defaultEncoding)
Sets the options for this writer.
|
void |
setOutput(OutputStream output)
Sets the output through its output stream.
|
void |
setOutput(String path)
Sets the output through the path of the output file.
|
void |
setParameters(IParameters params)
Sets new parameters for this writer.
|
void |
setWriter(IFilterWriter writer)
Set the
IFilterWriter used to write out the skeleton events. |
public SkeletonMergerWriter()
public SkeletonMergerWriter(IFilter skeletonFilter, IFilterWriter writer, ITextUnitMerger textUnitMerger)
IFilter and IFilterWriter implementationsskeletonFilter - - IFilter used to read skeleton, can be
serialized events or original source file. ASSUME
FILTER OPEN ALREADY CALLEDwriter - - override the writer specified in the skeleton
StartDocument event. Can use null value for
writer to use the default writer.textUnitMerger - user created ITextUnitMergerpublic String getName()
IFilterWritergetName in interface IFilterWriterpublic void setOptions(LocaleId targetLocale, String defaultEncoding)
IFilterWritersetOptions in interface IFilterWritertargetLocale - the output locale.defaultEncoding - Name of the character set encoding for the output.public void setOutput(String path)
IFilterWritersetOutput in interface IFilterWriterpath - Full path of the output file.public void setOutput(OutputStream output)
IFilterWritersetOutput in interface IFilterWriteroutput - Output stream to use for the output.public Event handleEvent(Event event)
IFilterWriterhandleEvent in interface IFilterWriterevent - The event to process.public void close()
IFilterWriterclose in interface AutoCloseableclose in interface IFilterWriterpublic Parameters getParameters()
IFilterWritergetParameters in interface IFilterWriterpublic void setParameters(IParameters params)
IFilterWritersetParameters in interface IFilterWriterparams - The new parameters to use.public void cancel()
IFilterWritercancel in interface IFilterWriterpublic EncoderManager getEncoderManager()
IFilterWritergetEncoderManager in interface IFilterWriterpublic ISkeletonWriter getSkeletonWriter()
IFilterWritergetSkeletonWriter in interface IFilterWriterprotected void processStartDocument()
StartDocument event to initialize the
IFilterWriter. Initialize the ITextUnitMergerprotected void processTextUnit(Event event)
TextUnit and match it up with its corresponding
skeleton version. Call ITextUnitMerger to merge the translated
segments into the skeleton TextUnitevent - - the translated version of the ITextUnit eventprotected Event processUntilTextUnit()
protected void processEndDocument()
TextUnits. Read the remaining skeleton events and
write them out.public void setWriter(IFilterWriter writer)
IFilterWriter used to write out the skeleton events. This
will override the internal writer as defined by StartDocument in the
skeleton.
Must be called immediately after construction!!
writer - - IFilterWriter used to write out the skeleton eventsCopyright © 2021. All rights reserved.