Package net.kyori.adventure.util
Interface Codec<D,E,DX extends Throwable,EX extends Throwable>
- Type Parameters:
D
- the decoded typeE
- the encoded typeDX
- the decode exception typeEX
- the encode exception type
A combination encoder and decoder.
- Since:
- 4.0.0
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Codec.Decoder<D,
E, X extends Throwable> A decoder.static interface
Codec.Encoder<D,
E, X extends Throwable> An encoder. -
Method Summary
Modifier and TypeMethodDescriptioncodec
(@NotNull Codec.Decoder<D, E, DX> decoder, @NotNull Codec.Encoder<D, E, EX> encoder) Creates a codec.Decodes.Encodes.of
(@NotNull Codec.Decoder<D, E, DX> decoder, @NotNull Codec.Encoder<D, E, EX> encoder) Deprecated.
-
Method Details
-
codec
@NotNull static <D,E, @NotNull Codec<D,DX extends Throwable, EX extends Throwable> E, codecDX, EX> (@NotNull @NotNull Codec.Decoder<D, E, DX> decoder, @NotNull @NotNull Codec.Encoder<D, E, EX> encoder) Creates a codec.- Type Parameters:
D
- the decoded typeE
- the encoded typeDX
- the decode exception typeEX
- the encode exception type- Parameters:
decoder
- the decoderencoder
- the encoder- Returns:
- a codec
- Since:
- 4.10.0
-
of
@Deprecated @ScheduledForRemoval(inVersion="5.0.0") @NotNull static <D,E, @NotNull Codec<D,DX extends Throwable, EX extends Throwable> E, ofDX, EX> (@NotNull @NotNull Codec.Decoder<D, E, DX> decoder, @NotNull @NotNull Codec.Encoder<D, E, EX> encoder) Deprecated.for removal since 4.10.0, usecodec(Codec.Decoder, Codec.Encoder)
instead.Creates a codec.- Type Parameters:
D
- the decoded typeE
- the encoded typeDX
- the decode exception typeEX
- the encode exception type- Parameters:
decoder
- the decoderencoder
- the encoder- Returns:
- a codec
- Since:
- 4.0.0
-
decode
Decodes.- Parameters:
encoded
- the encoded input- Returns:
- the decoded value
- Throws:
DX
- if an exception is encountered while decoding- Since:
- 4.0.0
-
encode
Encodes.- Parameters:
decoded
- the decoded value- Returns:
- the encoded output
- Throws:
EX
- if an exception is encountered while encoding- Since:
- 4.0.0
-
codec(Codec.Decoder, Codec.Encoder)
instead.