net.sf.okapi.common.layerprovider

## Class LayerProvider

- java.lang.Object
- - net.sf.okapi.common.layerprovider.LayerProvider

- All Implemented Interfaces:
    IEncoder, ILayerProvider

      public class LayerProvider
      extends java.lang.Object
      implements ILayerProvider

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LayerProvider()`
    `LayerProvider(java.nio.charset.CharsetEncoder outputEncoder, java.lang.String lineBreak)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `encode(char value, EncoderContext context)` Encodes a given character with this encoding.
    `java.lang.String` | `encode(int value, EncoderContext context)` Encodes a given code-point with this encoding.
    `java.lang.String` | `encode(java.lang.String text, EncoderContext context)` Encodes a given text with this encoder.
    `java.lang.String` | `endCode()` Gets the string denoting the end of external codes.
    `java.lang.String` | `endInline()` Gets the string denoting the end of inline codes.
    `java.lang.String` | `endSegment()` Gets the string denoting the end of a bilingual segment.
    `java.nio.charset.CharsetEncoder` | `getCharsetEncoder()` Gets the character set encoder used for this encoder.
    `java.lang.String` | `getEncoding()` Gets the name of the charset encoding to use.
    `java.lang.String` | `getLineBreak()` Gets the line-break to use for this encoder.
    `IParameters` | `getParameters()` Gets the parameters object with all the configuration information specific to this encoder.
    `java.lang.String` | `midSegment(int leverage)` Gets the string for the separator at the middle of a bilingual segment.
    `void` | `setOptions(IParameters params, java.lang.String encoding, java.lang.String lineBreak)` Sets the options for this encoder.
    `java.lang.String` | `startCode()` Gets the string denoting the start of external codes.
    `java.lang.String` | `startInline()` Gets the string denoting the start of inline codes.
    `java.lang.String` | `startSegment()` Gets the string denoting the start of a bilingual segment.
    `java.lang.String` | `toNative(java.lang.String propertyName, java.lang.String value)` Converts any property values from its standard representation to the native representation for this encoder.

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

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

- - ### Constructor Detail

    - #### LayerProvider

          public LayerProvider()

    - #### LayerProvider

          public LayerProvider(java.nio.charset.CharsetEncoder outputEncoder,
                       java.lang.String lineBreak)

  - ### Method Detail

    - #### endCode

          public java.lang.String endCode()

      Description copied from interface: `ILayerProvider`
      Gets the string denoting the end of external codes.
      Specified by:
        `endCode` in interface `ILayerProvider`
      Returns:
        The string denoting the end of external codes.

    - #### endInline

          public java.lang.String endInline()

      Description copied from interface: `ILayerProvider`
      Gets the string denoting the end of inline codes.
      Specified by:
        `endInline` in interface `ILayerProvider`
      Returns:
        The string denoting the end of inlinel codes.

    - #### startCode

          public java.lang.String startCode()

      Description copied from interface: `ILayerProvider`
      Gets the string denoting the start of external codes.
      Specified by:
        `startCode` in interface `ILayerProvider`
      Returns:
        The string denoting the start of external codes.

    - #### startInline

          public java.lang.String startInline()

      Description copied from interface: `ILayerProvider`
      Gets the string denoting the start of inline codes.
      Specified by:
        `startInline` in interface `ILayerProvider`
      Returns:
        The string denoting the start of inlinel codes.

    - #### startSegment

          public java.lang.String startSegment()

      Description copied from interface: `ILayerProvider`
      Gets the string denoting the start of a bilingual segment.
      Specified by:
        `startSegment` in interface `ILayerProvider`
      Returns:
        The string denoting the start of a bilingual segment.

    - #### endSegment

          public java.lang.String endSegment()

      Description copied from interface: `ILayerProvider`
      Gets the string denoting the end of a bilingual segment.
      Specified by:
        `endSegment` in interface `ILayerProvider`
      Returns:
        The string denoting the end of a bilingual segment.

    - #### midSegment

          public java.lang.String midSegment(int leverage)

      Description copied from interface: `ILayerProvider`
      Gets the string for the separator at the middle of a bilingual segment.
      Specified by:
        `midSegment` in interface `ILayerProvider`
      Parameters:
        `leverage` - Indicator of leverage to optionally place in the separator.
      Returns:
        The string for the separator at the middle of a bilingual segment.

    - #### encode

          public java.lang.String encode(java.lang.String text,
                                EncoderContext context)

      Description copied from interface: `IEncoder`
      Encodes a given text with this encoder.
      Specified by:
        `encode` in interface `IEncoder`
      Parameters:
        `text` - the text to encode.
        `context` - the context of the text: 0=text, 1=skeleton, 2=inline.
      Returns:
        the encoded text.

    - #### encode

          public java.lang.String encode(char value,
                                EncoderContext context)

      Description copied from interface: `IEncoder`
      Encodes a given character with this encoding.
      Specified by:
        `encode` in interface `IEncoder`
      Parameters:
        `value` - the character to encode.
        `context` - the context of the character: 0=text, 1=skeleton, 2=inline.
      Returns:
        the encoded character 9as a string since it can be now made up of more than one character).

    - #### encode

          public java.lang.String encode(int value,
                                EncoderContext context)

      Description copied from interface: `IEncoder`
      Encodes a given code-point with this encoding. If this method is called from a loop it is assumed that the code point is tested by the caller to know if it is a supplemental one or not and and any index update to skip the low surrogate part of the pair is done on the caller side.
      Specified by:
        `encode` in interface `IEncoder`
      Parameters:
        `value` - the code-point to encode.
        `context` - the context of the character: 0=text, 1=skeleton, 2=inline.
      Returns:
        the encoded character (as a string since it can be now made up of more than one character).

    - #### setOptions

          public void setOptions(IParameters params,
                        java.lang.String encoding,
                        java.lang.String lineBreak)

      Description copied from interface: `IEncoder`
      Sets the options for this encoder.
      Specified by:
        `setOptions` in interface `IEncoder`
      Parameters:
        `params` - the parameters object with all the configuration information specific to this encoder.
        `encoding` - the name of the charset encoding to use.
        `lineBreak` - the type of line break to use.

    - #### toNative

          public java.lang.String toNative(java.lang.String propertyName,
                                  java.lang.String value)

      Description copied from interface: `IEncoder`
      Converts any property values from its standard representation to the native representation for this encoder.
      Specified by:
        `toNative` in interface `IEncoder`
      Parameters:
        `propertyName` - the name of the property.
        `value` - the standard value to convert.
      Returns:
        the native representation of the given value.

    - #### getLineBreak

          public java.lang.String getLineBreak()

      Description copied from interface: `IEncoder`
      Gets the line-break to use for this encoder.
      Specified by:
        `getLineBreak` in interface `IEncoder`
      Returns:
        the line-break used for this encoder.

    - #### getCharsetEncoder

          public java.nio.charset.CharsetEncoder getCharsetEncoder()

      Description copied from interface: `IEncoder`
      Gets the character set encoder used for this encoder.
      Specified by:
        `getCharsetEncoder` in interface `IEncoder`
      Returns:
        the character set encoder used for this encoder. This can be null.

    - #### getParameters

          public IParameters getParameters()

      Description copied from interface: `IEncoder`
      Gets the parameters object with all the configuration information specific to this encoder.
      Specified by:
        `getParameters` in interface `IEncoder`
      Returns:
        the parameters object used for this encoder. This can be null.

    - #### getEncoding

          public java.lang.String getEncoding()

      Description copied from interface: `IEncoder`
      Gets the name of the charset encoding to use.
      Specified by:
        `getEncoding` in interface `IEncoder`
      Returns:
        the charset encoding used for this encoder.