Class MosesTextFilterWriter

  • All Implemented Interfaces:
    AutoCloseable, IFilterWriter

    public class MosesTextFilterWriter
    extends Object
    implements IFilterWriter
    Implementation of the IFilterWriter interface for Moses Text files. This class is not designed to be used with the Moses Text Filter, but as a standalone writer that can be driven by filter events.
    • Constructor Detail

      • MosesTextFilterWriter

        public MosesTextFilterWriter()
    • Method Detail

      • cancel

        public void cancel()
        Description copied from interface: IFilterWriter
        Cancels the current process.
        Specified by:
        cancel in interface IFilterWriter
      • close

        public void close()
        Description copied from interface: IFilterWriter
        Closes the output. Developers must make sure this method is safe to call even if there is nothing to close.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface IFilterWriter
      • getEncoderManager

        public EncoderManager getEncoderManager()
        Description copied from interface: IFilterWriter
        Gets the current encoder manager for this writer. Some special implementation of IFilterWriter may not use an encoder manager (for example writers that do not use skeleton).
        Specified by:
        getEncoderManager in interface IFilterWriter
        Returns:
        the current encoder manager for this writer, or null if none exists for this writer.
      • getSkeletonWriter

        public ISkeletonWriter getSkeletonWriter()
        Description copied from interface: IFilterWriter
        Gets the skeleton writer associated with this writer. Some implementation of IFilterWriter may not use a skeleton writer.
        Specified by:
        getSkeletonWriter in interface IFilterWriter
        Returns:
        the skeleton writer associated with this writer or null if none is associated.
      • getName

        public String getName()
        Description copied from interface: IFilterWriter
        Gets the name of this writer.
        Specified by:
        getName in interface IFilterWriter
        Returns:
        The name of the writer.
      • handleEvent

        public Event handleEvent​(Event event)
        Description copied from interface: IFilterWriter
        Handles the filter events.
        Specified by:
        handleEvent in interface IFilterWriter
        Parameters:
        event - The event to process.
        Returns:
        The event that was processed.
      • setOptions

        public void setOptions​(LocaleId locale,
                               String defaultEncoding)
        Description copied from interface: IFilterWriter
        Sets the options for this writer.
        Specified by:
        setOptions in interface IFilterWriter
        Parameters:
        locale - the output locale.
        defaultEncoding - Name of the character set encoding for the output.
      • setOutput

        public void setOutput​(String path)
        Description copied from interface: IFilterWriter
        Sets the output through the path of the output file.
        Specified by:
        setOutput in interface IFilterWriter
        Parameters:
        path - Full path of the output file.
      • setOutput

        public void setOutput​(OutputStream output)
        Description copied from interface: IFilterWriter
        Sets the output through its output stream.
        Specified by:
        setOutput in interface IFilterWriter
        Parameters:
        output - Output stream to use for the output.
      • setParameters

        public void setParameters​(IParameters params)
        Description copied from interface: IFilterWriter
        Sets new parameters for this writer.
        Specified by:
        setParameters in interface IFilterWriter
        Parameters:
        params - The new parameters to use.