Interface PrimitiveCodec<A>

All Superinterfaces:
Codec<A>, Decoder<A>, Encoder<A>

public interface PrimitiveCodec<A> extends Codec<A>
  • Method Details

    • read

      <T> DataResult<A> read(DynamicOps<T> ops, T input)
    • write

      <T> T write(DynamicOps<T> ops, A value)
    • decode

      default <T> DataResult<Pair<A,T>> decode(DynamicOps<T> ops, T input)
      Description copied from interface: Decoder
      Decodes an object from a serialized form, returning any remaining serialized data.
      Specified by:
      decode in interface Decoder<A>
      Type Parameters:
      T - the type of the serialized form
      Parameters:
      ops - a DynamicOps for the serialized form
      input - 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

      default <T> DataResult<T> encode(A input, DynamicOps<T> ops, T prefix)
      Description copied from interface: Encoder
      Encodes an object to a serialized form, adding to an existing prefix.
      Specified by:
      encode in interface Encoder<A>
      Type Parameters:
      T - the type to serialize to
      Parameters:
      input - the object to encode
      ops - a DynamicOps for the target serialized format
      prefix - 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