Class PlainLongCodec

  • All Implemented Interfaces:
    Codec

    public final class PlainLongCodec
    extends Object
    implements Codec
    Codec that saves long as a plain byte array. The delegate codec encodes all the rest data types.
    Since:
    0.8
    • Constructor Detail

      • PlainLongCodec

        public PlainLongCodec​(Codec delegate)
        Constructor.
        Parameters:
        delegate - Origin codec.
    • Method Detail

      • encode

        public byte[] encode​(Object object,
                             org.eolang.jeo.representation.bytecode.DataType type)
        Description copied from interface: Codec
        Encodes an object to a byte array.
        Specified by:
        encode in interface Codec
        Parameters:
        object - Object.
        type - Data type.
        Returns:
        Byte array.
      • decode

        public Object decode​(byte[] bytes,
                             org.eolang.jeo.representation.bytecode.DataType type)
        Description copied from interface: Codec
        Decodes a byte array to an object.
        Specified by:
        decode in interface Codec
        Parameters:
        bytes - Byte array.
        type - Data type.
        Returns:
        Object.