Package com.mojang.serialization.codecs
Interface PrimitiveCodec<A>
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mojang.serialization.Codec
Codec.ResultFunction<A>
Nested classes/interfaces inherited from interface com.mojang.serialization.Decoder
Decoder.Boxed<A>, Decoder.Simple<A>, Decoder.Terminal<A>
-
Field Summary
Fields inherited from interface com.mojang.serialization.Codec
BOOL, BYTE, BYTE_BUFFER, DOUBLE, EMPTY, FLOAT, INT, INT_STREAM, LONG, LONG_STREAM, PASSTHROUGH, SHORT, STRING
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> DataResult<Pair<A,
T>> decode
(DynamicOps<T> ops, T input) Decodes an object from a serialized form, returning any remaining serialized data.default <T> DataResult<T>
encode
(A input, DynamicOps<T> ops, T prefix) Encodes an object to a serialized form, adding to an existing prefix.<T> DataResult<A>
read
(DynamicOps<T> ops, T input) <T> T
write
(DynamicOps<T> ops, A value) Methods inherited from interface com.mojang.serialization.Codec
comapFlatMap, deprecated, dispatch, dispatch, dispatchMap, dispatchMap, dispatchStable, fieldOf, flatComapMap, flatXmap, listOf, mapResult, optionalFieldOf, optionalFieldOf, optionalFieldOf, optionalFieldOf, orElse, orElse, orElse, orElseGet, orElseGet, orElseGet, partialDispatch, promotePartial, stable, withLifecycle, xmap
Methods inherited from interface com.mojang.serialization.Decoder
boxed, decode, flatMap, map, parse, parse, simple, terminal
Methods inherited from interface com.mojang.serialization.Encoder
comap, encodeStart, flatComap
-
Method Details
-
read
-
write
-
decode
Description copied from interface:Decoder
Decodes an object from a serialized form, returning any remaining serialized data.- Specified by:
decode
in interfaceDecoder<A>
- Type Parameters:
T
- the type of the serialized form- Parameters:
ops
- aDynamicOps
for the serialized forminput
- the serialized form to decode- Returns:
- a
DataResult
containing the decoded object and any remaining serialized data, or an error if the object could not be decoded
-
encode
Description copied from interface:Encoder
Encodes an object to a serialized form, adding to an existing prefix.- Specified by:
encode
in interfaceEncoder<A>
- Type Parameters:
T
- the type to serialize to- Parameters:
input
- the object to encodeops
- aDynamicOps
for the target serialized formatprefix
- existing data that the encoded object should be added to- Returns:
- a
DataResult
containing the serialized form of the object, or an error if the object could not be serialized
-