Module org.firebirdsql.jaybird
Package org.firebirdsql.encodings

# Interface EncodingDefinition

All Known Implementing Classes:
  `DefaultEncodingDefinition`

public interface EncodingDefinition
Definition of a Firebird encoding. This is a mapping from the Firebird encoding to a Java Charset and additional information needed by Jaybird to process this encoding.

Since:
  3.0
Author:
  Mark Rotteveel

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Encoding`
  `getEncoding()`
  Gets the `Encoding` based on this definition.
  `int`
  `getFirebirdCharacterSetId()`
  `String`
  `getFirebirdEncodingName()`
  `Charset`
  `getJavaCharset()`
  `String`
  `getJavaEncodingName()`
  `int`
  `getMaxBytesPerChar()`
  `boolean`
  `isFirebirdOnly()`
  Can (or should) this encoding be used for reverse mapping from Java to Firebird.
  `boolean`
  `isInformationOnly()`
  Can this implementation create an `Encoding` instance, or does it provide information only (e.g.

- ## Method Details

  - ### getMaxBytesPerChar

    int getMaxBytesPerChar()
    Returns:
      Maximum number of bytes per character.

  - ### getJavaEncodingName

    String getJavaEncodingName()
    Returns:
      Java name of the encoding

  - ### getJavaCharset

    Charset getJavaCharset()
    Returns:
      Java `Charset` for this encoding

  - ### getFirebirdEncodingName

    String getFirebirdEncodingName()
    Returns:
      Firebird name of the encoding

  - ### getFirebirdCharacterSetId

    int getFirebirdCharacterSetId()
    Returns:
      Firebird id of the encoding

  - ### isFirebirdOnly

    boolean isFirebirdOnly()
    Can (or should) this encoding be used for reverse mapping from Java to Firebird.

    The best example of this is the Firebird character set `UNICODE-FSS` which maps to the Java character set `UTF-8`, but when Java character set`UTF-8` is requested, Jaybird should (in general) map to Firebird character set `UTF8`.

    Returns:
      `true` when this encoding maps from Java to Firebird, `false` otherwise

  - ### isInformationOnly

    boolean isInformationOnly()
    Can this implementation create an `Encoding` instance, or does it provide information only (e.g. about unsupported character sets)
    Returns:
      `true` if this EncodingDefinition only provides information, and is not capable of building a concrete implementation.

  - ### getEncoding

    Encoding getEncoding()
    Gets the `Encoding` based on this definition.

    Implementations can return the same instance on every call, or create a new one each time this method is called

    Returns:
      Encoding object or `null` if this is an information only EncodingDefinition
    See Also:
      - `isInformationOnly()`