Package net.sf.okapi.common.filters
Class SubFilterSkeletonWriter
- java.lang.Object
-
- net.sf.okapi.common.filters.SubFilterSkeletonWriter
-
- All Implemented Interfaces:
ISkeletonWriter
public class SubFilterSkeletonWriter extends Object implements ISkeletonWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSubFilterSkeletonWriter.TargetOutputsTarget outputs.
-
Field Summary
Fields Modifier and Type Field Description static StringGET_OUTPUT_TOKEN_ID
-
Constructor Summary
Constructors Constructor Description SubFilterSkeletonWriter(StartSubfilter resource)SubFilterSkeletonWriter(ISkeletonWriter skelWriter, IEncoder parentEncoder, String startResourceId, Set<String> handledTextUnitIds, StringBuilder sourceOutput, SubFilterSkeletonWriter.TargetOutputs targetOutputs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this skeleton writer.StringgetEncodedOutput(LocaleId locToUse)StringgetOutput()ISkeletonWritergetSkelWriter()StringgetSourceOutput()StringgetStartResourceId()StringprocessDocumentPart(DocumentPart resource)Processes the DOCUMENT_PART event.StringprocessEndDocument(Ending resource)Get output created by this skeleton writer from a sequence of events.StringprocessEndGroup(Ending resource)Processes the END_GROUP event.StringprocessEndSubDocument(Ending resource)Processes the END_SUBDOCUMENT event.StringprocessEndSubfilter(EndSubfilter resource)StringprocessStartDocument(LocaleId outputLocale, String outputEncoding, EncoderManager encoderManager, StartDocument resource)Processes the START_DOCUMENT event.StringprocessStartGroup(StartGroup resource)Processes the START_GROUP event.StringprocessStartSubDocument(StartSubDocument resource)Processes a START_SUBDOCUMENT event.StringprocessStartSubfilter(StartSubfilter resource)StringprocessTextUnit(ITextUnit resource)Processes the TEXT_UNIT event.StringprocessTextUnit(ITextUnit resource, boolean isMultilingual)Used for multilingual skeleton writers.SubFilterSkeletonWritersetOptions(LocaleId outputLocale, String outputEncoding, StartSubfilter startSubfilter)voidupdateTargetOutputs(String text)
-
-
-
Field Detail
-
GET_OUTPUT_TOKEN_ID
public static final String GET_OUTPUT_TOKEN_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SubFilterSkeletonWriter
public SubFilterSkeletonWriter(StartSubfilter resource)
-
SubFilterSkeletonWriter
public SubFilterSkeletonWriter(ISkeletonWriter skelWriter, IEncoder parentEncoder, String startResourceId, Set<String> handledTextUnitIds, StringBuilder sourceOutput, SubFilterSkeletonWriter.TargetOutputs targetOutputs)
-
-
Method Detail
-
close
public void close()
Description copied from interface:ISkeletonWriterCloses this skeleton writer.- Specified by:
closein interfaceISkeletonWriter
-
getStartResourceId
public String getStartResourceId()
-
processStartDocument
public String processStartDocument(LocaleId outputLocale, String outputEncoding, EncoderManager encoderManager, StartDocument resource)
Description copied from interface:ISkeletonWriterProcesses the START_DOCUMENT event.- Specified by:
processStartDocumentin interfaceISkeletonWriter- Parameters:
outputLocale- the output locale.outputEncoding- the name of the output charset encoding.encoderManager- the encoder manager to use.resource- the StartDocument resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processEndDocument
public String processEndDocument(Ending resource)
Get output created by this skeleton writer from a sequence of events. This method is useful when only an ISkeletonWriter reference is available.- Specified by:
processEndDocumentin interfaceISkeletonWriter- Parameters:
resource- can be with theGET_OUTPUT_TOKEN_IDID (to return the overall output of this skeleton writer), or any other Ending resource.- Returns:
- output of this skeleton writer if the resource is with the
GET_OUTPUT_TOKEN_IDID or an empty string otherwise.
-
processStartSubDocument
public String processStartSubDocument(StartSubDocument resource)
Description copied from interface:ISkeletonWriterProcesses a START_SUBDOCUMENT event.- Specified by:
processStartSubDocumentin interfaceISkeletonWriter- Parameters:
resource- the StartSubDocument resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processEndSubDocument
public String processEndSubDocument(Ending resource)
Description copied from interface:ISkeletonWriterProcesses the END_SUBDOCUMENT event.- Specified by:
processEndSubDocumentin interfaceISkeletonWriter- Parameters:
resource- the Ending resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processStartGroup
public String processStartGroup(StartGroup resource)
Description copied from interface:ISkeletonWriterProcesses the START_GROUP event.- Specified by:
processStartGroupin interfaceISkeletonWriter- Parameters:
resource- the StartGroup resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processEndGroup
public String processEndGroup(Ending resource)
Description copied from interface:ISkeletonWriterProcesses the END_GROUP event.- Specified by:
processEndGroupin interfaceISkeletonWriter- Parameters:
resource- the Ending resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processTextUnit
public String processTextUnit(ITextUnit resource)
Description copied from interface:ISkeletonWriterProcesses the TEXT_UNIT event.- Specified by:
processTextUnitin interfaceISkeletonWriter- Parameters:
resource- the TextUnit resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processTextUnit
public String processTextUnit(ITextUnit resource, boolean isMultilingual)
Description copied from interface:ISkeletonWriterUsed for multilingual skeleton writers. Processes the TEXT_UNIT event.- Specified by:
processTextUnitin interfaceISkeletonWriter- Parameters:
resource- the TextUnit resource associated with the event.isMultilingual- true if theITextUnitis multilingual.- Returns:
- the string output corresponding to this event.
-
processDocumentPart
public String processDocumentPart(DocumentPart resource)
Description copied from interface:ISkeletonWriterProcesses the DOCUMENT_PART event.- Specified by:
processDocumentPartin interfaceISkeletonWriter- Parameters:
resource- the DocumentPart resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processStartSubfilter
public String processStartSubfilter(StartSubfilter resource)
- Specified by:
processStartSubfilterin interfaceISkeletonWriter
-
processEndSubfilter
public String processEndSubfilter(EndSubfilter resource)
- Specified by:
processEndSubfilterin interfaceISkeletonWriter
-
getSourceOutput
public String getSourceOutput()
-
getOutput
public String getOutput()
-
updateTargetOutputs
public void updateTargetOutputs(String text)
-
setOptions
public SubFilterSkeletonWriter setOptions(LocaleId outputLocale, String outputEncoding, StartSubfilter startSubfilter)
-
getSkelWriter
public ISkeletonWriter getSkelWriter()
-
-