Interface Codec<D, E, DX extends Throwable, EX extends Throwable>

Type Parameters:
D - the decoded type
E - the encoded type
DX - the decode exception type
EX - the encode exception type

public interface Codec<D, E, DX extends Throwable, EX extends Throwable>
A combination encoder and decoder.
Since:
4.0.0
  • Method Details

    • codec

      static <D, E, DX extends Throwable, EX extends Throwable> Codec<D,E,DX,EX> codec(Codec.Decoder<D,E,DX> decoder, Codec.Encoder<D,E,EX> encoder)
      Creates a codec.
      Type Parameters:
      D - the decoded type
      E - the encoded type
      DX - the decode exception type
      EX - the encode exception type
      Parameters:
      decoder - the decoder
      encoder - the encoder
      Returns:
      a codec
      Since:
      4.10.0
    • decode

      D decode(E encoded) throws DX
      Decodes.
      Parameters:
      encoded - the encoded input
      Returns:
      the decoded value
      Throws:
      DX - if an exception is encountered while decoding
      Since:
      4.0.0
    • encode

      E encode(D decoded) throws EX
      Encodes.
      Parameters:
      decoded - the decoded value
      Returns:
      the encoded output
      Throws:
      EX - if an exception is encountered while encoding
      Since:
      4.0.0