Class GenericSkeletonWriter

    • Field Detail

      • ALLOWEMPTYOUTPUTTARGET

        public static String ALLOWEMPTYOUTPUTTARGET
      • outputLoc

        protected LocaleId outputLoc
      • isMultilingual

        protected boolean isMultilingual
      • allowEmptyOutputTarget

        @Deprecated
        protected boolean allowEmptyOutputTarget
        Deprecated.
      • useDisplayTextForCodes

        protected boolean useDisplayTextForCodes
      • outputEncoding

        protected String outputEncoding
    • Constructor Detail

      • GenericSkeletonWriter

        public GenericSkeletonWriter()
      • GenericSkeletonWriter

        public GenericSkeletonWriter​(boolean useDisplayTextForCodes)
    • Method Detail

      • setReferentCopies

        public void setReferentCopies​(int referentCopies)
        Sets the number of copies to keep for a referent. By default one copy is kept and discarded after it is referenced. Some layout may need to refer to the referent more than once, for example when they output both source and target.
        Parameters:
        referentCopies - the number of copies to hold (must be at least 1).
      • processStartDocument

        public String processStartDocument​(LocaleId outputLocale,
                                           String outputEncoding,
                                           EncoderManager encoderManager,
                                           StartDocument resource)
        Description copied from interface: ISkeletonWriter
        Processes the START_DOCUMENT event.
        Specified by:
        processStartDocument in interface ISkeletonWriter
        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)
        Description copied from interface: ISkeletonWriter
        Processes the END_DOCUMENT event.
        Specified by:
        processEndDocument in interface ISkeletonWriter
        Parameters:
        resource - the Ending resource associated with the event.
        Returns:
        the string output corresponding to this event.
      • processStartSubDocument

        public String processStartSubDocument​(StartSubDocument resource)
        Description copied from interface: ISkeletonWriter
        Processes a START_SUBDOCUMENT event.
        Specified by:
        processStartSubDocument in interface ISkeletonWriter
        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: ISkeletonWriter
        Processes the END_SUBDOCUMENT event.
        Specified by:
        processEndSubDocument in interface ISkeletonWriter
        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: ISkeletonWriter
        Processes the START_GROUP event.
        Specified by:
        processStartGroup in interface ISkeletonWriter
        Parameters:
        resource - the StartGroup resource associated with the event.
        Returns:
        the string output corresponding to this event.
      • _processStartGroup

        protected String _processStartGroup​(StartGroup resource)
      • processEndGroup

        public String processEndGroup​(Ending resource)
        Description copied from interface: ISkeletonWriter
        Processes the END_GROUP event.
        Specified by:
        processEndGroup in interface ISkeletonWriter
        Parameters:
        resource - the Ending resource associated with the event.
        Returns:
        the string output corresponding to this event.
      • _processEndGroup

        protected String _processEndGroup​(Ending resource)
      • processTextUnit

        public String processTextUnit​(ITextUnit resource)
        Description copied from interface: ISkeletonWriter
        Processes the TEXT_UNIT event.
        Specified by:
        processTextUnit in interface ISkeletonWriter
        Parameters:
        resource - the TextUnit resource associated with the event.
        Returns:
        the string output corresponding to this event.
      • processDocumentPart

        public String processDocumentPart​(DocumentPart resource)
        Description copied from interface: ISkeletonWriter
        Processes the DOCUMENT_PART event.
        Specified by:
        processDocumentPart in interface ISkeletonWriter
        Parameters:
        resource - the DocumentPart resource associated with the event.
        Returns:
        the string output corresponding to this event.
      • getString

        protected String getString​(ITextUnit tu,
                                   LocaleId locToUse,
                                   EncoderContext context)
        Gets the skeleton and the original content of a given text unit.
        Parameters:
        tu - The text unit to process.
        locToUse - locale to output. Use null for the source, or a LocaleId object for the target locales.
        context - Context flag: 0=text, 1=skeleton, 2=in-line.
        Returns:
        The string representation of the text unit.
      • getContent

        protected String getContent​(ITextUnit tu,
                                    LocaleId locToUse,
                                    EncoderContext context)
        Gets the original content of a given text unit.
        Parameters:
        tu - The text unit to process.
        locToUse - locale to output. Use null for the source, or the locale for the target locales.
        context - Context flag: 0=text, 1=skeleton, 2=inline.
        Returns:
        The string representation of the text unit content.
      • isCodeThatDisablesEncoding

        protected boolean isCodeThatDisablesEncoding​(Code code)
      • getContent

        public String getContent​(TextFragment tf,
                                 LocaleId locToUse,
                                 EncoderContext context)
        Gets the original content of a TextFragment.
        Parameters:
        tf - the TextFragment to process.
        locToUse - locale to output. Use null for the source, or the locale for the target locales. This is used for referenced content in inline codes.
        context - Context flag: 0=text, 1=skeleton, 2=inline.
        Returns:
        The string representation of the text unit content.
      • getStringFromSubfilter

        protected String getStringFromSubfilter​(StorageList list,
                                                LocaleId locToUse,
                                                EncoderContext context,
                                                boolean fromSource)
        Gets the string from a subfilter reference.
        Parameters:
        list - the StorageList reference that corresponds to the subfilter.
        locToUse - locale to output. Use null for the source, or the locale for the target locales. This is used for referenced content in inline codes.
        context - Context flag: 0=text, 1=skeleton, 2=inline.
        fromSource - true to get the source text from the subfilter, otherwise get the target text from the subfilter. This is used in the XLIFF filter to subfilter the source and the target separately.
        Returns:
        The string representation of the subfilter reference.
      • addToReferents

        public void addToReferents​(Event event)
      • getInputLoc

        public LocaleId getInputLoc()
      • getOutputLoc

        public LocaleId getOutputLoc()
      • isMultilingual

        public boolean isMultilingual()
      • isAllowEmptyOutputTarget

        @Deprecated
        public boolean isAllowEmptyOutputTarget()
        Deprecated.
      • getOutputEncoding

        public String getOutputEncoding()
      • getReferentCopies

        public int getReferentCopies()
      • setOutputLoc

        public void setOutputLoc​(LocaleId outputLoc)
      • setEncoderManager

        public void setEncoderManager​(EncoderManager encoderManager)
      • setMultilingual

        public void setMultilingual​(boolean isMultilingual)
      • setAllowEmptyOutputTarget

        @Deprecated
        public void setAllowEmptyOutputTarget​(boolean allowEmptyOutputTarget)
        Deprecated.
      • setOutputEncoding

        public void setOutputEncoding​(String outputEncoding)