net.sf.okapi.common.filterwriter

## Interface IFilterWriter

- All Superinterfaces:
    java.lang.AutoCloseable
  All Known Implementing Classes:
    GenericFilterWriter, TMXFilterWriter, XLIFFWriter, ZipFilterWriter

      public interface IFilterWriter
      extends java.lang.AutoCloseable

  Provides the common methods to generate an output from the events generated by a class that implements IFilter.

- - ### Method Summary

    Methods
    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.
    `java.lang.String` | `getName()` Gets the name of this writer.
    `IParameters` | `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.
    `void` | `setOptions(LocaleId locale, java.lang.String defaultEncoding)` Sets the options for this writer.
    `void` | `setOutput(java.io.OutputStream output)` Sets the output through its output stream.
    `void` | `setOutput(java.lang.String path)` Sets the output through the path of the output file.
    `void` | `setParameters(IParameters params)` Sets new parameters for this writer.

- - ### Method Detail

    - #### getName

          java.lang.String getName()

      Gets the name of this writer.
      Returns:
        The name of the writer.

    - #### setOptions

          void setOptions(LocaleId locale,
                        java.lang.String defaultEncoding)

      Sets the options for this writer.
      Parameters:
        `locale` - the output locale.
        `defaultEncoding` - Name of the character set encoding for the output.

    - #### setOutput

          void setOutput(java.lang.String path)

      Sets the output through the path of the output file.
      Parameters:
        `path` - Full path of the output file.

    - #### setOutput

          void setOutput(java.io.OutputStream output)

      Sets the output through its output stream.
      Parameters:
        `output` - Output stream to use for the output.

    - #### handleEvent

          Event handleEvent(Event event)

      Handles the filter events.
      Parameters:
        `event` - The event to process.
      Returns:
        The event that was processed.

    - #### close

          void close()

      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 `java.lang.AutoCloseable`

    - #### getParameters

          IParameters getParameters()

      Gets the current parameters for this writer.
      Returns:
        The current parameters for this writer.

    - #### setParameters

          void setParameters(IParameters params)

      Sets new parameters for this writer.
      Parameters:
        `params` - The new parameters to use.

    - #### cancel

          void cancel()

      Cancels the current process.

    - #### getEncoderManager

          EncoderManager getEncoderManager()

      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).
      Returns:
        the current encoder manager for this writer, or null if none exists for this writer.

    - #### getSkeletonWriter

          ISkeletonWriter getSkeletonWriter()

      Gets the skeleton writer associated with this writer. Some implementation of IFilterWriter may not use a skeleton writer.
      Returns:
        the skeleton writer associated with this writer or null if none is associated.