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

# Interface Encoding

public interface Encoding
Encoding translates between a Java string and a byte array for a specific (Firebird) encoding.

Encoding implementations need to be thread-safe.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Reader`
  `createReader(InputStream inputStream)`
  Creates a reader wrapping an input stream.
  `Writer`
  `createWriter(OutputStream outputStream)`
  Creates a writer wrapping an input stream.
  `String`
  `decodeFromCharset(byte[] in)`
  Decodes the supplied byte array to a String.
  `String`
  `decodeFromCharset(byte[] in, int offset, int length)`
  Decodes a part of the supplied byte array to a String.
  `byte[]`
  `encodeToCharset(String in)`
  Encodes the supplied String to bytes in this encoding.
  `String`
  `getCharsetName()`

- ## Method Details

  - ### encodeToCharset

    byte[] encodeToCharset(String in)
    Encodes the supplied String to bytes in this encoding.
    Parameters:
      `in` - String to encode
    Returns:
      Byte array with encoded string

  - ### decodeFromCharset

    String decodeFromCharset(byte[] in)
    Decodes the supplied byte array to a String.
    Parameters:
      `in` - byte array to decode
    Returns:
      String after decoding the byte array

  - ### decodeFromCharset

    String decodeFromCharset(byte[] in, int offset, int length)
    Decodes a part of the supplied byte array to a String.
    Parameters:
      `in` - byte array to decode
      `offset` - Offset into the byte array
      `length` - Length in bytes to decode
    Returns:
      String after decoding the byte array

  - ### getCharsetName

    String getCharsetName()
    Returns:
      The name of the Java character set.

  - ### createReader

    Reader createReader(InputStream inputStream)
    Creates a reader wrapping an input stream.
    Parameters:
      `inputStream` - Input stream
    Returns:
      Reader applying this encoding when reading

  - ### createWriter

    Writer createWriter(OutputStream outputStream)
    Creates a writer wrapping an input stream.
    Parameters:
      `outputStream` - Input stream
    Returns:
      Writer applying this encoding when writing