net.sf.okapi.common.filterwriter

## Class GenericFilterWriter

- java.lang.Object
- - net.sf.okapi.common.filterwriter.GenericFilterWriter

- All Implemented Interfaces:
    IFilterWriter

      public class GenericFilterWriter
      extends java.lang.Object
      implements IFilterWriter

  Implements the IFilterWriter interface for filters that use the GenericSkeleton skeleton.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.io.OutputStreamWriter` | `writer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GenericFilterWriter()`
    `GenericFilterWriter(ISkeletonWriter skelWriter, EncoderManager encoderManager)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancel()` Cancels the current process.
    `void` | `close()` Closes the output.
    `protected java.nio.charset.CharsetEncoder` | `createCharsetEncoder(java.lang.String encodingtoUse)` Provides sub-classes an opportunity to creates the character set encoder for the output.
    `java.lang.String` | `getDefEncoding()`
    `EncoderManager` | `getEncoderManager()` Gets the current encoder manager for this writer.
    `protected java.lang.String` | `getEncoding()`
    `LocaleId` | `getLocale()`
    `java.lang.String` | `getName()` Gets the name of this writer.
    `protected java.lang.String` | `getOutputPath()`
    `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.
    `protected void` | `setEncoderManager(EncoderManager encoderManager)`
    `protected void` | `setEncoding(java.lang.String encoding)`
    `protected void` | `setLocale(LocaleId locale)`
    `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.
    `protected void` | `setSkelWriter(ISkeletonWriter skelWriter)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### writer

          protected java.io.OutputStreamWriter writer

  - ### Constructor Detail

    - #### GenericFilterWriter

          public GenericFilterWriter()

    - #### GenericFilterWriter

          public GenericFilterWriter(ISkeletonWriter skelWriter,
                             EncoderManager encoderManager)

  - ### 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 `IFilterWriter`

    - #### getName

          public java.lang.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.

    - #### 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.

    - #### setSkelWriter

          protected void setSkelWriter(ISkeletonWriter skelWriter)

    - #### getParameters

          public IParameters getParameters()

      Description copied from interface: `IFilterWriter`
      Gets the current parameters for this writer.
      Specified by:
        `getParameters` in interface `IFilterWriter`
      Returns:
        The current parameters for this 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,
                        java.lang.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(java.lang.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(java.io.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.

    - #### createCharsetEncoder

          protected java.nio.charset.CharsetEncoder createCharsetEncoder(java.lang.String encodingtoUse)

      Provides sub-classes an opportunity to creates the character set encoder for the output.
      Parameters:
        `encodingtoUse` - the name of the encoding to use.
      Returns:
        the decoder to use for the output or null. When null is returned (default) the output uses the encoding.

    - #### getLocale

          public final LocaleId getLocale()

    - #### getDefEncoding

          public final java.lang.String getDefEncoding()

    - #### getEncoding

          protected java.lang.String getEncoding()

    - #### setEncoding

          protected void setEncoding(java.lang.String encoding)

    - #### getOutputPath

          protected java.lang.String getOutputPath()

    - #### setLocale

          protected void setLocale(LocaleId locale)

    - #### setEncoderManager

          protected void setEncoderManager(EncoderManager encoderManager)