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

All Methods Instance Methods Abstract Methods
`java.io.Reader` `createReader​(java.io.InputStream inputStream)` Creates a reader wrapping an input stream.
`java.io.Writer` `createWriter​(java.io.OutputStream outputStream)` Creates a writer wrapping an input stream.
`java.lang.String` `decodeFromCharset​(byte[] in)` Decodes the supplied byte array to a String.
`java.lang.String` `decodeFromCharset​(byte[] in, int offset, int length)` Decodes a part of the supplied byte array to a String.
`byte[]` `encodeToCharset​(java.lang.String in)` Encodes the supplied String to bytes in this encoding.
`java.lang.String` `getCharsetName()`

### Method Detail

#### encodeToCharset

    byte[] encodeToCharset​(java.lang.String in)

Encodes the supplied String to bytes in this encoding.

Parameters:
  `in` - String to encode
Returns:
  Byte array with encoded string

#### decodeFromCharset

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

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

    java.lang.String getCharsetName()

Returns:
  The name of the Java character set.

#### createReader

    java.io.Reader createReader​(java.io.InputStream inputStream)

Creates a reader wrapping an input stream.

Parameters:
  `inputStream` - Input stream
Returns:
  Reader applying this encoding when reading

#### createWriter

    java.io.Writer createWriter​(java.io.OutputStream outputStream)

Creates a writer wrapping an input stream.

Parameters:
  `outputStream` - Input stream
Returns:
  Writer applying this encoding when writing