Codec.ResultFunction<A>
Decoder.Boxed<A>, Decoder.Simple<A>, Decoder.Terminal<A>
BOOL, BYTE, BYTE_BUFFER, DOUBLE, EMPTY, FLOAT, INT, INT_STREAM, LONG, LONG_STREAM, PASSTHROUGH, SHORT, STRING
Constructor and Description |
---|
MapCodecCodec(MapCodec<A> codec)
Constructs a new
MapCodec.MapCodecCodec with the given underlying map codec. |
Modifier and Type | Method and Description |
---|---|
MapCodec<A> |
codec()
Returns the underlying
MapCodec backing this codec. |
<T> DataResult<(A,T)> |
decode(DynamicOps<T> ops,
T input)
Decodes an object from the specified serialized data.
|
<T> DataResult<T> |
encode(A input,
DynamicOps<T> ops,
T prefix)
Encodes an object into the specified serialized data.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
checkRange, comapFlatMap, compoundList, deprecated, dispatch, dispatch, dispatchMap, dispatchMap, dispatchStable, doubleRange, either, fieldOf, flatComapMap, flatXmap, floatRange, intRange, list, listOf, mapEither, mapPair, mapResult, of, of, of, of, optionalField, optionalFieldOf, optionalFieldOf, optionalFieldOf, optionalFieldOf, orElse, orElse, orElse, orElseGet, orElseGet, orElseGet, pair, partialDispatch, promotePartial, simpleMap, stable, unboundedMap, unit, unit, withLifecycle, xmap
public MapCodecCodec(MapCodec<A> codec)
MapCodec.MapCodecCodec
with the given underlying map codec.codec
- The map codec that backs this codec.public <T> DataResult<(A,T)> decode(DynamicOps<T> ops, T input)
Decoder
DataResult
.decode
in interface Decoder<A>
T
- The type of the serialized form.ops
- The DynamicOps
instance defining the serialized form.input
- The serialized data.Pair
containing the decoded object and the remaining serialized data, wrapped in a DataResult
.public <T> DataResult<T> encode(A input, DynamicOps<T> ops, T prefix)
Encoder
DataResult
.encode
in interface Encoder<A>
T
- The type of the serialized form.input
- The object to serialize.ops
- The DynamicOps
instance defining the serialized form.prefix
- The existing serialized data to append to.DataResult
wrapping the serialized form of input
, appended to prefix
.