Class JavaCodec

  • All Implemented Interfaces:
    Codec

    public final class JavaCodec
    extends Object
    implements Codec
    Plain codec. Converts objects to bytes and vice versa using Java type sizes.
    Since:
    0.8
    Suppressed Checkstyle violations:
    CyclomaticComplexityCheck (500 lines)
    • Constructor Detail

      • JavaCodec

        public JavaCodec()
    • Method Detail

      • encode

        public byte[] encode​(Object value,
                             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:
        value - 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.